Hello teachers, I try to create a new project, and then do the following steps. The console will warn me of errors.
1: Create a new UI. 2: Give the UI a state machine. 3: Click to enter the sub state under state machine. 4: Click start to run and then click end. 5: Switch to the state machine main interface. 6: Error reporting.
I don’t know the logic of this error. Although it doesn’t seem to affect the operation, it seems to be a version of a bug?
Attach console information:
NullReferenceException: Object reference not set to an instance of an object
Unity.VisualScripting.VisualScriptingCanvas`1[TGraph].OnToolbarGUI () (at Library/PackageCache/com.unity.visualscripting@1.7.8/Editor/VisualScripting.Core/Canvases/VisualScriptingCanvas.cs:1683)
Unity.VisualScripting.StateCanvas.OnToolbarGUI () (at Library/PackageCache/com.unity.visualscripting@1.7.8/Editor/VisualScripting.State/Graph/StateCanvas.cs:105)
Unity.VisualScripting.GraphWindow.OnGUI () (at Library/PackageCache/com.unity.visualscripting@1.7.8/Editor/VisualScripting.Core/Windows/GraphWindow.cs:572)
Thank you for your answer 
1 Like
Trying closing/removing the graph tab, open it again
Thank you, but this error will still be reported. It will happen when the window is closed or the state machine is reloaded.
Getting the same error both in 2021.3.27 and 2022.3.3. Was there ever a bug filed fire this? Hugely annoying that the default Unity Visual Scripting packages causes these errors.
Steps to replicate:
Create a state machine with two Script States.
Enter play mode.
Swap between the script states
NullReferenceException: Object reference not set to an instance of an object
Unity.VisualScripting.VisualScriptingCanvas`1[TGraph].OnToolbarGUI () (at Library/PackageCache/com.unity.visualscripting@1.8.0/Editor/VisualScripting.Core/Canvases/VisualScriptingCanvas.cs:1683)
Unity.VisualScripting.StateCanvas.OnToolbarGUI () (at Library/PackageCache/com.unity.visualscripting@1.8.0/Editor/VisualScripting.State/Graph/StateCanvas.cs:105)
Unity.VisualScripting.GraphWindow.OnGUI () (at Library/PackageCache/com.unity.visualscripting@1.8.0/Editor/VisualScripting.Core/Windows/GraphWindow.cs:572)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at :0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at :0)
UnityEditor.DockArea.OldOnGUI () (at :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 :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at :0)
1 Like