Question by
kr8gz · Oct 28, 2020 at 08:57 PM ·
animationanimatornullreferenceexception
Animator just gives "NullReferenceException: Object not set to an instance of an object" when trying to record animation
So I have been following a tutorial on YouTube until here, where he says that "the play buttons turn red because he is in record mode". I did exactly the same things he did in the video, but my play buttons don't turn red, and when I press the record button in the animator, I get the following error:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorWindow.RefreshStylesAfterExternalEvent () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.AnimationMode.StopAnimationRecording () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditorInternal.AnimationWindowControl.StopRecording () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditorInternal.AnimationWindowState.StopRecording () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.AnimEditor.RecordButtonOnGUI () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.AnimEditor.PlayControlsOnGUI () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.AnimEditor.OnAnimEditorGUI (UnityEditor.EditorWindow parent, UnityEngine.Rect position) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.AnimationWindow.OnGUI () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.DockArea.OldOnGUI () (at <e6e2fa0a47414cd2ac33237924761b45>: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 <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <819de1aa368e45faa4f78e26c97c62b0>:0)
I have looked around for solutions, but the only thing I found was to restart Unity, which didn't work for me. Any help is appreciated
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613014735im_/https://answers.unity.com/themes/thub/images/avi.jpg)