Search Unity

Question GUI Error: You are pushing more GUIClips than you are popping, and more!

Discussion in 'Editor & General Support' started by pKallv, Jan 14, 2022.

  1. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,190
    Hi,
    I am getting the following errors:

    I am using normal Canvas based UI and tried things I have found googling but I am not able to fix this, especially the GUI popping problem. I would really appreciate some tips on how to approach this

    I also get the following errors:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.SceneView.CallOnPreSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3637)
    3. UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2216)
    4. UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2298)
    5. UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2223)
    6. 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)
    7. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    8.  

    Code (CSharp):
    1. [code=CSharp]GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    3.  

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.SceneView.CallOnPreSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3637)
    3. UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2216)
    4. UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2298)
    5. UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2223)
    6. 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)
    7. 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:687)
    8. 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:659)
    9. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:652)
    10. 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)
    11. 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)
    12. UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:535)
    13. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/EventHandler.cs:151)
    14. UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/IEventDispatchingStrategy.cs:74)
    15. 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)
    16. 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)
    17. 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)
    18. 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)
    19. 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)
    20. 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)
    21. 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:417)
    22. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:468)
    23. 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)
    24. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:74)
    25. 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)
    26. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    27.  
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,819
    Looks like a bog-standard null reference error to me. Most likely you're trying to display something, be it an image or text or whatever, that's null. If you figure out the cause of the null ref, you'll stop GUIClips error as well.

    I get these errors on occasion working with custom inspectors where I forget to guard something with a null check, or something I thought should be there isn't there due to erroneous code.
     
  3. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,190
    I have been spending so much time to try to solve this but not succeeded. Most surprised was I when I started a new project and got it very early but could still not find the source of the problem. I do not know what to do so I just leave it there for now.
     
  4. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,190
    kojiruri likes this.
  5. dcdemars

    dcdemars

    Joined:
    May 18, 2012
    Posts:
    22
    They closed the bug with the resolution : wont fix.

    (Note: I still see the error messages pop up randomly)
     
    A_Marraff, mowax74, TV4Fun and 3 others like this.
  6. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,190
  7. Franzco

    Franzco

    Joined:
    May 30, 2022
    Posts:
    1
    Late to the party, but for future people...I started getting these errors and they seem to be something with Unity rather than my code. I would add images (no code), run it and get no problems. I would then add more images (no code), run it and *bam* I get this error. (Wasted Hours Trying To Figure It Out: 4 hours).
     
  8. mkudimov

    mkudimov

    Joined:
    Jan 7, 2018
    Posts:
    14
    Me too
     
  9. Arrdenet

    Arrdenet

    Joined:
    May 15, 2022
    Posts:
    10
    Yeah, I get this error any time I have something selected in the hierarchy and click run. Then the error gets thrown, I click something else in the hierarchy, and unpause - and things work just fine. It's really weird.
     
  10. TV4Fun

    TV4Fun

    Joined:
    Jan 10, 2020
    Posts:
    31
    This appears to be a bug with Unity that the devs have marked as won't fix. It is clearly a common issue and not exactly low pain, so let's continue to bug them on it.
     
    pKallv likes this.
  11. Kyriakos80

    Kyriakos80

    Joined:
    Sep 30, 2017
    Posts:
    49
    Are you all using Screen Space-Overly render mode by any chance?
    If i deselect everything but TexCoord1 under Additional Shader Channels the error seems to go away for a while but the selection won't stick.
     
  12. trnq1ll0

    trnq1ll0

    Joined:
    Aug 30, 2019
    Posts:
    46
    I have the same problem with Unity 2022.2.10b. The problem seems to be a broken Unity menu. I have inserted and edited two particle systems. After the first playback, these errors suddenly appeared in huge numbers. Possible connection with the fact that with one of the two particle systems the "Particles" dialogue in the Scene View is simply missing. With the other PSystem it is there. If the particle system in question is deleted, no more errors appear. So it seems to be an error in the programme in my Unity version.
     
  13. unity_1713349

    unity_1713349

    Joined:
    Oct 19, 2022
    Posts:
    1
    I am having the same issue for AR
     
  14. C88D

    C88D

    Joined:
    Jun 16, 2022
    Posts:
    12
    My project only gives the errors if the problematic text is selected in the hierarchy. Strange o_O
    I wonder if de-selecting the text in scene view hierarchy works for anyone else.
     
    mikot_ and kodav4 like this.
  15. conjugategames

    conjugategames

    Joined:
    Jun 8, 2016
    Posts:
    4
    I tried this, and as long as I don't select either the text or a parent in the hierarchy, the error does not occur. 2021.3.8f1.
     
    mikot_, sakamoto-kun and kodav4 like this.
  16. Code_to_the_top

    Code_to_the_top

    Joined:
    Jan 2, 2023
    Posts:
    5
    You're right thanks mate
     
  17. BorpaBoatski

    BorpaBoatski

    Joined:
    Aug 3, 2018
    Posts:
    54
    I switched back my layout to default and the error seems to have stopped
     
    Incandescenter and ExulIkari like this.
  18. AnneAtMarel

    AnneAtMarel

    Joined:
    Mar 9, 2022
    Posts:
    2
    Using 2021.3.18f1 and getting them on a regular base too.
    Haven't tried to get back to the default layout as I don't want to! I just want to have the error gone, or at least know what is causing it!
     
  19. BorpaBoatski

    BorpaBoatski

    Joined:
    Aug 3, 2018
    Posts:
    54
    You can save your current layout by going to Window>Layout>Save Layout. Then you can switch to default and back to your saved layout. I'm not sure if the error might cause issues with it saving your layout.
     
    GeneralDollar likes this.
  20. Figarist

    Figarist

    Joined:
    Jul 14, 2017
    Posts:
    8
    For me, it's a layout bug. When I change the layout, it always works like a charm.
     
  21. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    564
    What in the fiery hell. I spent a long damn time trying to fix this. They market it as Won't fix???
     
  22. laripek

    laripek

    Joined:
    Mar 18, 2024
    Posts:
    1
    This happened to me when I dragged a bunch of game objects into an empty parent. I Undo that action and the errors disappeared. Then I was able to manually do it again and get no error.
    For future people, if you can take back the action that caused this error, it seems to fix it.
     
  23. noshio_dahar

    noshio_dahar

    Joined:
    Nov 1, 2023
    Posts:
    5
    Well I have this error with a clean project, just importing a new package, and it does not even import it !!