After I have edited my animation state machine in the Animator Controller, I often get the following bug when playing my game. I think it is related to me deleting transitions from the animation state machine, but I can not get the bug to go away.
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.AnimationStateMachine.TransitionInspector.OnEnable () (at /Applications/buildAgent/work/812c4f5049264fad/Editor/Graphs/UnityEditor.Graphs/AnimationStateMachine/TransitionInspector.cs:70)
I was getting this issue as well. I tried removing the Animation Controllers and recreating them (without ever creating any transitions). I applied the new controllers to my characters, but was still seeing this error.
What finally resolved it was to save my file, shut down Unity and then relaunch it. It seems the reference was cached in the IDE, and restarting allowed it to be cleared.
animator = GetComponent();
Is your problem. The “GetComponent” call requires a component type to get. For example:
animator = GetComponent(Animator);
What I did was I delete all the metadata in the assets folder library/metadata. That problem triggers when I untick the animator exit time, it throws the nullreferenceexception, I found restarting is a solution but the better way is deleting the metadata and then poof! The bug is gone.