OnGUIでGUILayoutとかを使って何かを描画したりするときに出たエラーの解決方法のメモ。
GUI Error
GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
このエラーはGUILayoutでBeginしたのにEndしてないとかで始まりと終わりを囲えてないと出る。
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.EndScrollView(); // ←ここを書き忘れてると出る
ScrollViewなら EndScrollView() を書き忘れてないか確認する。
InvalidOperationException
InvalidOperationException: Operation is not valid due to the current state of the object System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:321) UnityEngine.GUI.EndScrollView (Boolean handleScrollWheel) (at C:/buildslave/unity/build/Modules/IMGUI/GUI.cs:1414)
このエラーは逆で、EndScrollView() だけ存在してる場合とかに出る。 終わりがあるのに始まりがない。
編集して消した時とかに消し忘れてるとたまに出したりする。