LoginSignup
4
1

More than 5 years have passed since last update.

iOS実機でUnityアプリを起動するとCreateMaterialで落ちる

Posted at

症状

Unityで作ったアプリをiOS実機で起動した場合、Unityロゴが出る前に以下のようなエラーが出て、画面に何も表示されないまま30秒後ぐらいに"Thread 1"の"CreateMaterial"が"EXC_BAD_ACCESS"で落ちることがあります。

NullReferenceException: A null value was found where an object instance was required.
  at UnityChan.FaceUpdate.OnGUI () [0x00000] in <filename unknown>:0 
(Filename: currently not available on il2cpp Line: -1)

Unity_CreateMaterial_Error.png

原因

iOS版では対応していない.ddsファイル(DXT3,DXT5などの圧縮テクスチャ)がMaterialに設定してある場合に発生します。

なので、上記のエラーは副作用というか、全体の初期化が終了する前にGameObjectが走ってしまって、本来は生成済みのはずのオブジェクトが存在しない状況が発生しているようです。

回避策

ddsファイルを使用せず、tgaやpngのような生画像をAssetとして登録して、Unity側で圧縮しましょう。

以上、めっちゃ基本的な話でした。マルチプラットフォーム開発においてUnityが面倒見てくれる部分と見てくれない部分を、一度洗いだしたほうが良さそう…。

参考

EXC_Bad_Access Thread CreateMaterial ()
http://answers.unity3d.com/questions/1234358/exc-bad-access-thread-creatematerial.html

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1