spoiledcat / git-for-unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Window Spinner null

teemusocialfirst opened this issue · comments

Prerequisites

Windows, Unity version 2022.2.3f1, Git for Unity 1.0.12

Description

There is an issue where the UI window starts throwing null reference exceptions endlessly and the editor becomes unusable and must be restarted. Here's the stack trace:

NullReferenceException: Object reference not set to an instance of an object
Unity.VersionControl.Git.Window.Update () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/Window.cs:502)
UnityEditor.HostView.SendUpdate () (at <83719566e1474cd8800c02cd178db127>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <83719566e1474cd8800c02cd178db127>:0)

Steps to Reproduce

This happens every time I'm switching branches. I'm not sure if it has to do with the branch change itself, or the fact that the other branch has different packages, so the package manager needs to do some work when switching.

Additional Information

The problem has gone away by restarting the editor earlier, but as I'm creating this issue, I'm running into additional problems and can't list the branches or history anymore. I'm getting the following log entries before initializing the Git plugin:

ArgumentException: You can only call GUI functions from inside OnGUI.
UnityEngine.GUIUtility.CheckOnGUI () (at <72cf1e8588764282840c296f43a3b160>:0)
UnityEngine.GUI.get_skin () (at <72cf1e8588764282840c296f43a3b160>:0)
Unity.VersionControl.Git.Styles.get_Label () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/Misc/Styles.cs:211)
Unity.VersionControl.Git.Utility.get_IsDarkTheme () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/Misc/Utility.cs:18)
Unity.VersionControl.Git.Styles.GetIconName (System.String name) (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/Misc/Styles.cs:1171)
Unity.VersionControl.Git.Styles.get_ActiveBranchIcon () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/Misc/Styles.cs:840)
Unity.VersionControl.Git.BranchesView.OnEnable () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/BranchesView.cs:78)
Unity.VersionControl.Git.Window.OnEnable () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/Window.cs:94)
UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
UnityEditor.WindowLayout:LoadDefaultWindowPreferences()
Exception: Style.Draw may not be called with GUIContent that is null.
UnityEngine.GUIStyle.Draw (UnityEngine.Rect position, UnityEngine.GUIContent content, System.Int32 controlId, System.Boolean isHover, System.Boolean isActive, System.Boolean on, System.Boolean hasKeyboardFocus) (at <72cf1e8588764282840c296f43a3b160>:0)
UnityEngine.GUIStyle.Draw (UnityEngine.Rect position, UnityEngine.GUIContent content, System.Boolean isHover, System.Boolean isActive, System.Boolean on, System.Boolean hasKeyboardFocus) (at <72cf1e8588764282840c296f43a3b160>:0)
Unity.VersionControl.Git.TreeNode.Render (UnityEngine.Rect rect, System.Single indentation, System.Boolean isSelected, System.Boolean treeIsBusy, UnityEngine.GUIStyle toggleStyle, UnityEngine.GUIStyle nodeStyle, UnityEngine.GUIStyle activeNodeStyle) (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/TreeControl.cs:519)
Unity.VersionControl.Git.Tree`2[TNode,TData].Render (UnityEngine.Rect treeDisplayRect, UnityEngine.Vector2 scroll, System.Action`1[T] singleClick, System.Action`1[T] doubleClick, System.Action`1[T] rightClick) (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/TreeControl.cs:79)
Unity.VersionControl.Git.BranchesView.OnTreeGUI (UnityEngine.Rect rect) (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/BranchesView.cs:371)
Unity.VersionControl.Git.BranchesView.Render () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/BranchesView.cs:213)
Unity.VersionControl.Git.BranchesView.OnGUI () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/BranchesView.cs:180)
Unity.VersionControl.Git.Window.DoActiveViewGUI () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/Window.cs:686)
Unity.VersionControl.Git.Window.OnUI () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/Window.cs:467)
Unity.VersionControl.Git.BaseWindow.OnGUI () (at ./Library/PackageCache/com.spoiledcat.git@1.0.12/Editor/UI/BaseWindow.cs:95)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <83719566e1474cd8800c02cd178db127>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <83719566e1474cd8800c02cd178db127>:0)
UnityEditor.DockArea.OldOnGUI () (at <83719566e1474cd8800c02cd178db127>:0)
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 <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <06e1dd5e5fd24a409eecb058150a859e>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <72cf1e8588764282840c296f43a3b160>:0)

These two are logged, then Initialized Git for Unity version 1.0.12+4b882be09f after which the second message Exception: Style.Draw may not be called with GUIContent that is null. gets repeated infinitely.

Argh, Unity changed where you can grab the current skin again, sigh. I'll get a fix going for that.

Hi, any news on this? I recently updated Unity to 2022.3.4f1 and GFU no longer works. I get the "ArgumentException: You can only call GUI functions from inside OnGUI." error mentioned above. I can use the command line but I'm concerned my colleagues will struggle with it. Happy to take a look at a PR if you can point me in the right direction - I've not made a Unity plugin before but am familiar with Unity.

Hi, any news on this? I recently updated Unity to 2022.3.4f1 and GFU no longer works. I get the "ArgumentException: You can only call GUI functions from inside OnGUI." error mentioned above. I can use the command line but I'm concerned my colleagues will struggle with it. Happy to take a look at a PR if you can point me in the right direction - I've not made a Unity plugin before but am familiar with Unity.

I'm sorry, life happened and I just couldn't make the time to look at this. I'm fixing it today, new packages should be coming out soon, assuming CI doesn't die on me again 🤞

Hi, any news on this? I recently updated Unity to 2022.3.4f1 and GFU no longer works. I get the "ArgumentException: You can only call GUI functions from inside OnGUI." error mentioned above. I can use the command line but I'm concerned my colleagues will struggle with it. Happy to take a look at a PR if you can point me in the right direction - I've not made a Unity plugin before but am familiar with Unity.

I'm sorry, life happened and I just couldn't make the time to look at this. I'm fixing it today, new packages should be coming out soon, assuming CI doesn't die on me again 🤞

No problem at all - thanks for sorting it out. If I can help at all give me a shout!