errors when creating new scene in editor from OdinEditorWindow

Issue #536 resolved
Former user created an issue

Odin 2.0.20, editor only mode
Unity 2019.1.2f1

Createa an OdinEditorWindow, add a method that calls EditorSceneManager.NewScene(NewSceneSetup.EmptyScene), decorate it with a [Button] attribute.
Show the window and click the button, the following errors come up:

Pop call mismatch; no corresponding push call! Each call to Pop must always correspond to one - and only one - call to Push.
UnityEngine.Debug:LogError(Object)
Sirenix.Utilities.Editor.GUIScopeStack`1:Pop() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIScopeStack.cs:29)
Sirenix.Utilities.Editor.GUIHelper:PopColor() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIHelper.cs:566)
Sirenix.OdinInspector.Editor.Drawers.DefaultMethodDrawer:DrawPropertyLayout(GUIContent) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/DefaultMethodDrawer.cs:154)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176)
Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:540)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:384)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:301)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditor(Int32) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:857)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditors() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:699)
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:638)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

InvalidOperationException: Stack empty.
System.Collections.Generic.Stack1[T].ThrowForEmptyStack () (at <c9226b2f33b7421e85bb391f94075e49>:0) System.Collections.Generic.Stack1[T].Pop () (at <c9226b2f33b7421e85bb391f94075e49>:0)
Sirenix.OdinInspector.Editor.InspectorProperty.PopDraw () (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:643)
Sirenix.OdinInspector.Editor.InspectorProperty.Draw (UnityEngine.GUIContent defaultLabel) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:607)
Sirenix.OdinInspector.Editor.InspectorUtilities.DrawPropertiesInTree (Sirenix.OdinInspector.Editor.PropertyTree tree) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:384)
Rethrow as OdinPropertyException: This error occurred while being drawn by Odin.
Odin Property Path: Method
Odin Drawer Chain: DefaultMethodDrawer.
UnityEngine.Debug:LogException(Exception)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:399)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:301)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditor(Int32) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:857)
Sirenix.OdinInspector.Editor.OdinEditorWindow:DrawEditors() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:699)
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:638)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Pop call mismatch; no corresponding push call! Each call to Pop must always correspond to one - and only one - call to Push.
UnityEngine.Debug:LogError(Object)
Sirenix.Utilities.Editor.GUIScopeStack`1:Pop() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIScopeStack.cs:29)
Sirenix.Utilities.Editor.GUIHelper:PopLabelWidth() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIHelper.cs:796)
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:642)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Pop call mismatch; no corresponding push call! Each call to Pop must always correspond to one - and only one - call to Push.
UnityEngine.Debug:LogError(Object)
Sirenix.Utilities.Editor.GUIScopeStack`1:Pop() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIScopeStack.cs:29)
Sirenix.Utilities.Editor.GUIHelper:PopHierarchyMode() (at C:/Sirenix/Sirenix Solution/Sirenix.Utilities.Editor/GUI/GUIHelper.cs:623)
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:643)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

EndLayoutGroup: BeginLayoutGroup must be called first.
UnityEditor.EditorGUILayout:EndVertical()
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:645)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

EndLayoutGroup: BeginLayoutGroup must be called first.
UnityEditor.EditorGUILayout:EndScrollView()
Sirenix.OdinInspector.Editor.OdinEditorWindow:OnGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:649)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Comments (3)

  1. Antonio Rafael Antunes Miranda

    Try to delay the creation by calling EditorApplication.delayCall += () => EditorSceneManager.NewScene(NewSceneSetup.EmptyScene)
    This sort of error often occurs if the natural flow of the GUI execution gets interrupted by other calls. Delaying it to execute at a safer time often helps.

  2. Log in to comment