AnimatorController randomly self imploded and I don't know what else to do

Hello.
I’m in an emergency with my long running project (3+ years).

Suddenly the Animator controller for the player messed up, with no input on my own, it was working well for years and yesterday it just decided to not show anything in the Animator window, yet the animations work when I click play but keep getting the error if I open it in the animator window, and I’m getting this error… Please, tell me I don’t have to re-do the whole thing, it was a very polished work and I don’t want to lose it.

How it happened: Randomly while using Unity 2022, then I backed it up and upgraded to Unity 6 to see if a Unity version change would help me… It did, btw, I could start seeing my controller states again and no error, then randomly it started happening again, it’s only happening to that controller.

Here’s a screenshot:

Here’s the whole error log from the console:

ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <eb0ef51e5908461ca908fdf6b2dbd966>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) (at <eb0ef51e5908461ca908fdf6b2dbd966>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.FindNode (UnityEditor.Animations.AnimatorState state) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.FindNodeForEdges (UnityEditor.Animations.AnimatorState state) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.CreateEntryEdges (UnityEditor.Animations.AnimatorTransition transition, UnityEditor.Animations.AnimatorStateMachine owner) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.CreateEdges () (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.BuildGraphFromStateMachine (UnityEditor.Animations.AnimatorStateMachine stateMachine) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.RebuildGraph () (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimationStateMachine.GraphGUI.OnGraphGUI () (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimatorControllerTool.StateMachineView (UnityEngine.Rect position, System.Single zoomLevel) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimatorControllerTool.DoGraph (UnityEngine.Rect graphRect, System.Single zoomLevel) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__140_11 () (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimatorControllerTool.ScopedOnGUI (System.Action onGUIHandler) (at <7d2ac93d1eb94615af95d9a56a0f7c65>:0)
UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__140_9 () (at <7d2ac93d1eb94615af95d9a56a0f7c65>: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 <5968ce65056b40d4a7a81f60d007014a>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Sounds like something triggers a bug in the Animator GUI. It means your data apparently isn’t affected but something does cause the UI to malfunction.

With 3+ years working on that project surely you make regular backups and/or use source control? If not, best to start right now. With source control you could actually pinpoint every change since it stopped working, making it much easier to analyze and fix issues like this.

For now, I would try restarting the project to see if this only gets triggered eventually while working in the project but not right away. If that isn’t helping, try deleting the Library, could be all that’s needed. Resetting the layout (top right corner button) also sometimes helps but you’ll lose your window layout - best save it first.

1 Like

Thank you, I just found the problem: In the controller YAML code there was a wrong “id” in one of the properties, it was something introduced by Unity itself since this was created while manipulating the GUI.

My method was to go back in commits until I found a version of the file that didn’t have the problem. And I didn’t have to go too far, it was 2 commits ago, I recovered it and it worked but was an old version, so I went change by change in the code to see which one triggered that error specifically and found out a wrong reference that, once I set it back the one in the good version, it stopped happening.

Kind of a surgical process, damn… And I could just fix it because the controllers are just standard YAML files that one can see and edit in a text editor.

1 Like