なえ箱

メモを植えます

SimulatorビルドがNSInternalInconsistencyExceptionで通らない【Unity】

この記事をシェアする

UnityからSimulator SDKで書き出したアプリをXcodeのシミュレータで実行しようとしたら、エラーが出て実行できない時の解決方法のメモ。

Uncaught exception: NSInternalInconsistencyException: [UnityAppController renderingAPI] called before [UnityAppController selectRenderingApi]

f:id:nae3na:20210818233032p:plain
ここでエラーが出る

解決方法

UnityのPlayer Settings > Other SettingsのAuto Graphics APIを無効にして、Graphics APIsにOpenGLES3を追加する

f:id:nae3na:20210818233138p:plain
OpenGLES3を追加

XcodeのシミュレータはMetalサポートしてないので、Metalだけではビルドが通らないみたい。

We are experiencing the same issue running Unity 2017.2.0p3 on a MacBook Pro (15-inch, 2016) with a Radeon Pro 450 2 GB. The iPhone X simulator crashes as soon as the app starts if Metal is selected as the rendering API, works fine under OpenGL or Auto.

answers.unity.com

OpenGLかAutoで動作するよって書いてあったけど、画像の通りAutoかつその設定で入っていたOpenGLES2があっても変わらずエラーが出る。

手動でOpenGLES3を追加して再度ビルド。その後Xcodeで実行したら問題なくシミュレータで実行できた。

解決する時に参考にしたリンク

answers.unity.com

hecres.hatenablog.com