TAKOYAKING’s blog 一覧

TAKOYAKING’s blog

たこ焼き系

Unity: Script Execution Orderを変更すると不明なエラーがでる

script Execution orderを変更したら以下のような大量のエラーが出ました。
特に悪いことはしていないので、とりあえず回避できる方法を載せておきます。

MissingReferenceException: The object of type 'MonoScript' has been destroyed but you are still trying to access it.
GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
ArgumentException: GUILayout: Mismatched LayoutGroup.repaint
Scope was not disposed! You should use the 'using' keyword or manually call Dispose.

環境

  • Unity 2019.3.9f1
  • Mac
  • Enter Play Modeを使用

原因

Enter Play Modeを使っていて、Script Execution Orderを変更して、再生すると発生します。

解決策

f:id:TAKOYAKING:20200524185451p:plain
設定するときにこの画面を表示していますが、設定完了した後に、Script Execution Orderの画面を違う画面に表示させるとエラーは起きなくなります。例えば一つ上のQualityを表示させてみるとエラーが消えるはずです。

感想

Script Execution Order画面だけではなく、他の画面でも昔はたまに画面を表示させているだけでエラーが起こる現象が起こっていたような気がします。(例えば分析画面とか・・・)

なので悪いことしていないのにエラーが大量に出た場合は画面を切り替えてみると良いかもしれません。