Unity– category –
-
Unity
【Unity】StandardAssetsのインポート不足時エラー
今日のエラー The name `Hoge' does not exist in the current context 原因 StandardAssetsのインポート不足 解決 不足しているStandardAssetsをImportPackagesからインポートする。 環境 OSX El Capitan v10.11.5 Unity v5.3.5f1 -
Unity
【Unity】値が変わった時にUnityEditorを一時停止する
概要 ObserveEveryValueChangedを使うと、値の変動を検知して処理を差し込むことができます。 今回はthisのlocalPosition.xが1になった時、実行中のUnityEditorを一時停止します。 環境 OSX El Capitan v10.11.4 Unity v5.3.5f1 コード using UniRx; Start... -
Unity
【Unity/Android】Android6.0からのパーミッションとUnity
【Android】6.0からのパーミッションでも書きましたが、Android6.0からは実装上表示上ともにパーミッションの取り扱いが大きく変わりました。 Android上については、NTTソフトウェア様の記事がわかりやすくなっていたので紹介しておきます。 その1 その2 ... -
Unity
【Unity】PrefabをGameObject.Instantiate(Resources.Load())で読み込もうとして、ArgumentException: The thing you want to instantiate is null.
今日のエラー prefabをロードしようとすると、返り値がNullになった。 さらにNullから参照しようとしたため、Object reference not set to an instance of an object エラーとなった。 コード GameObject go = Instantiate(Resources.Load ("hoge")as Game... -
Unity
【Unity】二次元配列の初期化でIndexOutOfRangeException
今日のエラー 二次元配列をこのような形で初期化したところ、data[1, 1]を読もうとすると IndexOutOfRangeException: Array index is out of range. となった。 コード int[,] data = new int[,] { { 0 }, { 2, 2 ,2 }, { 1, 100 }, { 100, -1 , 2} }; 原... -
Unity
【Unity】Animatorの更新タイミングを変更する
Animatorを使い始めの時、更新タイミングが意図せず遅延してモヤッとしていました。 speedを上げれば良いのかなぁとか訳のわからないことを考えていたのですが、 Animatorコンポーネントのupdate ModeをAnimatePhysicsに変更すると AnimationControllerのu... -
Unity
【Unity】OnCollisionEnter2Dが呼ばれない!2D物理演算の衝突判定における原因と解決法
Unityにおける2Dゲーム開発において、オブジェクト同士の当たり判定(衝突判定)は非常に重要な要素です。しかし、実装を進める中で「コードは正しいはずなのに OnCollisionEnter2D メソッドが呼ばれない(発火しない)」というトラブルは、多くの開発者が... -
Unity
【Unity】Image(Script)のSourceImageを変更する
今日のメモ ランタイム中にSourceImageを変更する。 Image.material.mainTexture Texture texture = Resources.Load("image path") as Texture; Image img = GameObject.Find("Canvas/Panel/***").GetComponent(); img.material.mainTexture = texture; Im... -
Unity
【Unity】Failed to add the asset file size for
今日のエラー Consoleに Failed to add the asset file size for ***.*** なる黄色アイコンの警告がたくさん表示された。 解決法 公式の報告スレより、Unityのバージョンを更新するとFIXされているとのこと。 環境 OSX El Capitan v10.11 Unity v5.2.1f1 -
Unity
【Unity】AnimationEvent has no function name specified!
今日のエラー Consoleに '(GameObject名)' AnimationEvent has no function name specified! と赤字で警告が出た。 解決法 AnimationEventをGameObjectに設定し、かつFunctionを指定しないと発生する。 なので、次のどちらかをするとエラーが消える。 Anim... -
Unity
【Unity】uGUIのUI描画や操作性を追加するコンポーネント
文字やイメージといったUIにエフェクトを追加できるコンポーネントがuGUIに標準で備わっていて、簡単便利。 描画に関わるコンポーネント Shadow UIの輪郭に影を付けてくれる。 http://docs.unity3d.com/ja/current/Manual/script-Shadow.html Outline UIの... -
Unity
【Unity】テキストファイルを読み込もうとすると、ArgumentException: The thing you want to instantiate is null.
今日のエラー テキストをロードしようとすると、返り値がNullになった。 さらにNullから参照しようとしたため、Object reference not set to an instance of an object エラーとなった。 コード public static string FilePath = "Text/text"; public stat...
