IndexOutOfRange Exception on creating an Animation Clip. NOT a code error; Error only appears after creating the clip.
I'm on part 3: Animations of the Sprite Animations chapter of the Ruby's Adventure 2D tutorial project:
I'm seeing a weird "IndexOutOfRange" exception whenever I try to make an animation clip. This is NOT a code error: this error only appears when I try to make an animation clip. Otherwise, it displays: The Animator Controller (Robot) you have used is not valid. Animations will not play. This is expected, since I'm trying to add animations and animation clips to that animator controller, something I'm also having trouble doing.
Platform: Windows 10
Unity version: 2020.3.0f1
IDE: Visual Studio 2019, Version 16.10.0
C# version: Microsoft .NET Framework Version 4.8.04084
The error:
IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEditorInternal.AnimationWindowUtility.AddClipToAnimatorComponent (UnityEngine.Animator animator, UnityEngine.AnimationClip newClip) (at :0)
UnityEditorInternal.AnimationWindowUtility.AddClipToAnimationPlayerComponent (UnityEngine.Component animationPlayer, UnityEngine.AnimationClip newClip) (at :0)
UnityEditorInternal.AnimationWindowUtility.EnsureAnimationPlayerHasClip (UnityEngine.Component animationPlayer) (at :0)
UnityEditorInternal.AnimationWindowUtility.InitializeGameobjectForAnimation (UnityEngine.GameObject animatedObject) (at :0)
UnityEditor.AnimEditor.SetupWizardOnGUI (UnityEngine.Rect position) (at :0)
UnityEditor.AnimEditor.MainContentOnGUI (UnityEngine.Rect contentLayoutRect) (at :0)
UnityEditor.AnimEditor.OnAnimEditorGUI (UnityEditor.EditorWindow parent, UnityEngine.Rect position) (at :0)
UnityEditor.AnimationWindow.OnGUI () (at :0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at :0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, 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)
Your answer
Follow this Question
Related Questions
change player position when animation in played 0 Answers
Why isn't my animation looping? 3 Answers
Character rolls forward,but slides back after animation 2 Answers
[2D] Play animation backward. 1 Answer
Animation Constantly Playing? 1 Answer