Search Unity

Bug Weird glitch in Unity?

Discussion in 'Editor & General Support' started by LinkingLink14, Mar 22, 2023.

  1. LinkingLink14

    LinkingLink14

    Joined:
    Apr 22, 2022
    Posts:
    9
    I tried to open an animator for my weapon, and the animator was invisible and I got this error:


    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Graphs.AnimationStateMachine.Graph.GenerateConnectionKey (UnityEditor.Graphs.Node srcNode, UnityEditor.Graphs.Node dstNode) (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimationStateMachine.Graph.GetEdgeInfo (UnityEditor.Graphs.Edge edge) (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimationStateMachine.EdgeGUI.DoEdges () (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimationStateMachine.GraphGUI.OnGraphGUI () (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimatorControllerTool.StateMachineView (UnityEngine.Rect position, System.Single zoomLevel) (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimatorControllerTool.DoGraph (UnityEngine.Rect graphRect, System.Single zoomLevel) (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__143_12 () (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimatorControllerTool.ScopedOnGUI (System.Action onGUIHandler) (at <c9d804319889444480938d3c761b2e0a>:0)
    UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__143_10 () (at <c9d804319889444480938d3c761b2e0a>: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 <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <7096c6494db14f0c807ca461735e58a8>:0)
    Rethrow as ImmediateModeException
    UnityEngine.UIElements.UIR.RenderChain.Render () (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.Panel.UpdateForRepaint () (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <7096c6494db14f0c807ca461735e58a8>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <89d2c0fe37e0454991daf2807b7dcb63>:0)


    Anyone know what this means, and how to fix it? Any help would be extremely appreciated.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,674
    This specific error, coming from this location (eg, NOT your code, such as
    UnityEditor.Graphs
    ), is often fixed by either Reset Layouts (upper right) or else Right-click Project, Reimport-All.

    Otherwise, if it's your code, it's always the same:

    How to fix a NullReferenceException error

    https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

    Three steps to success:
    - Identify what is null <-- any other action taken before this step is WASTED TIME
    - Identify why it is null
    - Fix that