積極的に使うべし http://ufcpp.net/study/csharp/sp3_linq.html
Unityでは子要素は親要素のポジションを追従してしまうのでボタンを思ったポジションに表示することができない
http://vaikong.hatenadiary.jp/entry/2015/01/27/232147
// 解決策としてはSetParentの第二引数にfalseを渡せばOkです
GameObject obj = (GameObject)Resources.Load ("Prefabs/ToOutSidePlate");
GameObject prefab = (GameObject)Instantiate (obj);
prefab.transform.SetParent (parentObject.transform,false);
ScriptableObject の Prefab に変換するツール https://github.com/tsubaki/Unity-Excel-Importer-Maker/tree/multisheet
http://docs.unity3d.com/ja/current/Manual/CameraRays.html
> Ray のもっとも一般的な使用方法は レイキャスト をシーンに向かって実行することです。raycast は仮想の “レーザービーム” を ray に沿って原点から発してシーンのコライダーに衝突するまで進みます。
対象にはコライダをつけよう。「あれ?反応しない?」というときに陥りがち。
http://tsubakit1.hateblo.jp/entry/2015/04/13/010645
ExecuteEvents.Execute を使おう
> この機能は、特定のインターフェースを持つコンポーネントを一括で操作する機能を有しています。要するに文字列ではなくインターフェースでメソッドを呼び出すSendMessageみたいなものです。
- 送信側・受信側が見つけやすい
- コールバック一覧をエディタで確認できる
IEventSystemHandlerを継承しているインターフェースを持つコンポーネントは、Inspectorに新しくInetrceptedEventsの項目が表示されます。この項目にはどのコンポーネントが、どのメソッドを受信する(可能性がある)事を示してくれます。 - リファクタリングの容易さです
- 引数の指定が容易
- SendMessageと比較してとても高速
http://tsubakit1.hateblo.jp/entry/2016/04/01/184607
- ローカルサーバーを構築してAssetBundleを配置する
- AssetBundleを構築せず動作をシミュレート
特にこの二つ
Security.frameworkが足りない
http://c-geru.com/as_blind_side/category/xcode
- http://gamexunity.blogspot.jp/2015/10/ios_27.html
- http://forum.unity3d.com/threads/unexpected-code-bundle-unity4xc-xcplugin.338773/
- https://github.com/kankikuchi/XcodeProjectUpdater
- http://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.html
- http://qiita.com/tkyaji/items/19dfff4afe228c7f34a1
http://blog.naichilab.com/entry/2015/09/17/083000
http://blog.naichilab.com/entry/2015/09/17/083000
m ファイル、 mm ファイル の Inspector から必要とする FrameWork にチェックを入れるのがミソ
用意されているものは、 Unity のライフサイクル (MonoBehaviour) ありきの仕組み 依存したくないなら、自前で造る
.bundle が抜けた
頻繁に記事を更新している http://framesynthesis.jp/tech/2015/12/gearvr/
http://anopara.matrix.jp/2014/04/24/cusing%E3%81%AE%E7%9B%AE%E7%9A%84%E3%81%A8%E4%BD%BF%E3%81%84%E6%96%B9/ http://hensa40.cutegirl.jp/archives/1428
ファイル A.txt を1行ずつ読み込んで B.txt に書き込むといった単純なサンプルを例に。
StreamReader sr = null;
try
{
sr = new StreamReader(@"E:\A.txt", System.Text.Encoding.Default);
StreamWriter sw = null;
try
{
sw = new StreamWriter(@"E:\B.txt", false);
// ファイルから読み込めるものがなくなるまで読み込む
while (sr.Peek() >= 0)
{
// ファイルから 1 行読み込んで、そのまま出力する
sw.WriteLine(sr.ReadLine());
}
}
catch (Exception ex)
{
// 何かエラー処理
}
finally
{
if (sw != null) { sw.Close(); }
}
}
catch (Exception ex)
{
// 何かエラー処理
}
finally
{
if (sr != null) { sr.Close(); }
}
これが、
using (StreamReader sr = new StreamReader(@"E:\A.txt", System.Text.Encoding.Default))
{
using (StreamWriter sw = new StreamWriter(@"E:\B.txt", false))
{
// ファイルから読み込めるものがなくなるまで読み込む
while (sr.Peek() >= 0)
{
// ファイルから 1 行読み込んで、そのまま出力する
sw.WriteLine(sr.ReadLine());
}
}
}
こうなる。 特徴は、
- usingでインスタンス化されたオブジェクトが必ず解放される
- 例外処理が発生しても (しなくても)、ステートメントブロックを抜けると必ず解放される
- 解放処理の必要な標準関数は、ほぼ全て対応している
- IDisposable インターフェイスを使えば、using 対応を自作できる
http://qiita.com/baba_s/items/c536b923b6cdd919e73e
- 原因 : シーン遷移時は古いシーンと新しいシーンが同時にメモリに載る
- 解決 : 新しいシーンを読み込む前に空のシーンを読み込むことで回避できる
空のシーンで以下のような処理を行うべき
Resources.UnloadUnusedAssets() で、現在使用していないアセットを破棄を開始して、終了してから次のシーンへ遷移させる
public class BindVoidManager : MonoBehaviour {
public static string NextScene = null;
// Use this for initialization
void Start () {
StartCoroutine (ClearMemoryAndLoadSceneAsync ());
}
// Update is called once per frame
void Update () {
}
//
private IEnumerator ClearMemoryAndLoadSceneAsync(){
//現在使用していないアセットを破棄
AsyncOperation unloader = Resources.UnloadUnusedAssets();
while (!unloader.isDone) {
yield return null;
}
System.GC.Collect();
StartCoroutine (LoadSceneAsync());
}
//非同期のシーンロード
private IEnumerator LoadSceneAsync(){
AsyncOperation asyncLoading = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync (NextScene, UnityEngine.SceneManagement.LoadSceneMode.Single);
yield return asyncLoading;
}
}
- GCがあまり動かないようにするために
- classの代わりにstructにするとすべてインラインになる
- classはフラグメンテーションが起きてしまう
- 構造体のほうがキャッシュパフォーマンス的にいい