Search Issue Tracker
Won't Fix
Votes
2
Found in
2021.2.0b13
2021.2.13f1
Issue ID
1407707
Regression
Yes
GUI and NullReferenceException errors are thrown when entering Play mode
How to reproduce:
1. Open the user-submitted project
2. Open the scene "SampleScene" (Assets/Scenes/SampleScene.unity)
3. In the Hierarchy window, select the GameObject "Canvas" and enter Play mode
4. While Play mode is loading, start clicking the left mouse button inside the Scene view
5. When Play mode has loaded, inspect the Console window (Window > General > Console)
Expected result: No errors are seen
Actual result: GUI and NullReferenceException errors are seen
Reproducible with: 2021.2.0b13, 2021.2.15f1
Not reproducible with: 2019.4.36f1, 2020.3.31f1, 2021.2.0b12, 2022.1.0a1, 2022.1.0b11, 2022.2.0a7
Note: Might take a few tries to reproduce. Retry from step 3 if the errors didn't appear.
Errors:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.SceneView.CallOnPreSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3659)
GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
-
Williamsii
Sep 05, 2022 18:00
reproduced when migrating from 2020.3.33f to 2021.3.8f1
-
TV4Fun
Aug 26, 2022 04:07
On a cursory glance, it appears that this is being caused by one of the editors in `SceneView.activeEditors` being a null reference and `CallOnPreSceneGUI` not checking for this. I'm guessing this has to do with the custom `Editor` I am using for one of my components not being properly destructed, as it is not in `activeEditors`, but I don't have any data on why this would be, as I'm not sure how `Editor`s are supposed to be added to or removed from `activeEditors`. This bug is eminently reproducible, affecting a large number of users, and not exactly pain free, so I think closing this issue was premature.
-
TV4Fun
Aug 25, 2022 20:07
Still getting this error on 2021.4.7f1. It comes in a triplet of errors:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.SceneView.CallOnPreSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3690)
UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2248)
UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2330)
UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2255)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:351)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)NullReferenceException: Object reference not set to an instance of an object
UnityEditor.SceneView.CallOnPreSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3690)
UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2248)
UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2330)
UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2255)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:372)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:693)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:665)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:658)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:618)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:607)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:535)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/EventHandler.cs:151)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/IEventDispatchingStrategy.cs:74)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:35)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:26)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:19)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:381)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:344)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:222)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Panel.cs:419)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:468)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:211)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189) -
kamran-bigdely
Aug 25, 2022 00:38
I also got this issue on 2021.3.8f1
-
duartejuca
Aug 23, 2022 19:55
This occurs with me too, when I use Layer Pallette Profile, with Terrain Tools
-
Kopegim
Aug 23, 2022 00:58
Same problem in 2021.3.8f1
Not at all "low user pain" -
mkudimov
Aug 06, 2022 21:42
reproduced on 2021.3.7f1
-
theProject
Jul 24, 2022 14:21
Issue still pops up in 2021.3.6F1
-
zhengyi73
Jul 21, 2022 06:27
I have the same problem on 2021.3.6f1.
-
NatTheTacocat
Jul 05, 2022 14:24
I just started all of a sudden getting this on 2021.3.4f1. I thought it might be related to an old Debug Build, but I deleted that file and am still getting it. Unity please reopen this!
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2021.3.X):
This does not reproduce on the current editor version, and given how inconsistent and low user pain this problem is I am closing with "wont fix".