IndexOutOfRangeException in Animation

IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEditorInternal.AnimationWindowUtility.AddClipToAnimatorComponent (UnityEngine.Animator animator, UnityEngine.AnimationClip newClip) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:947)
UnityEditorInternal.AnimationWindowUtility.AddClipToAnimationPlayerComponent (UnityEngine.Component animationPlayer, UnityEngine.AnimationClip newClip) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:927)
UnityEditorInternal.AnimationWindowUtility.EnsureAnimationPlayerHasClip (UnityEngine.Component animationPlayer) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:921)
UnityEditorInternal.AnimationWindowUtility.InitializeGameobjectForAnimation (UnityEngine.GameObject animatedObject) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:888)
UnityEditor.AnimEditor.SetupWizardOnGUI (UnityEngine.Rect position) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:476)
UnityEditor.AnimEditor.MainContentOnGUI (UnityEngine.Rect contentLayoutRect) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:270)

I was going to try the animation, doing one, but then this error happened. Does anyone knows how to solve it?

Hi @VascoGeada, i had the same problem, and sadly the only way for me to fix it, was to delete the animator i had on the object (in my case the camera), and create a new one. Then i had to reaply all my animations to the animator controller, create the transitions and parameters again, and then i had to re-reference the animator in all the places where i was using it in variables. It’s annoying, but that’s the only way i could find…