- Home /
Has anyone seen this error before: IndexOutOfRangeException: Array index is out of range. UnityEditorInternal....
Has anyone seen this error before: IndexOutOfRangeException: Array index is out of range. UnityEditorInternal.AnimationWindowUtility.AddClipToAnimatorComponent (UnityEngine.Animator animator, UnityEngine.AnimationClip newClip) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:536) UnityEditorInternal.AnimationWindowUtility.AddClipToAnimationPlayerComponent (UnityEngine.Component animationPlayer, UnityEngine.AnimationClip newClip) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs:516) ?
This happens when I try to create an animation on a flap of a sterile gloves package that I made in Blender. The only examples I found of the IndexOutOfRangeException were on peoples scripts but mine is on a internal animation script in the Unity 5 engine... or so it appears. If anyone has any tips or need more info from me please ask because I really need this flap to rotate open...
Answer by Picc_Excellence · Apr 16, 2016 at 08:58 AM
Thanks to both of you for trying and sorry for the super delayed solve response... We're trying to convert to WebGL (helps us all.) Updating Unity solved the issue so the world may never know.
Answer by Bunny83 · Mar 25, 2016 at 12:03 PM
Hmm, the only thing i've found in the AddClipToAnimatorComponent method that could possible throw this error is this line
ChildAnimatorState childAnimatorState = animatorController.layers[0].stateMachine.FindState(newClip.name);
It simply gets the first layer on the animatorController, however it seems your layers array is empty. Your Animator statemachine should have at least one layer.
I cant recreate the error. I've tried a few things but all I managed to do is crash Unity :P
I made a cube and opened the Animation window and clicked create. It prompted me to save an anim file and a clip was also created. You cant remove the base layer of an anim file. But the crash occurred when I added Animation component, added the new clip and removed the Animator component.
Its just that the docs around AnimationClip are actually quite bizarre and they seem to fall over themselves.
AnimationClip : AnimationClip is used by Animation to play back animations.
Of course Animation is the Legacy animation component.
However, AnimationClip inherits from $$anonymous$$otion : Base class for AnimationClips and BlendTrees. $$anonymous$$otions are used by animation States in the $$anonymous$$ecanim State$$anonymous$$achines.
It seems to make some kind of sense but leads a lot of people to mix the two components. Im wondering if that is somehow the case here.
The only other way of thinking I had here was if perhaps the anim file had become corrupted or somehow altered like if you were duplicating and rena$$anonymous$$g files while the windows were open... you know that kind of typical windows-esque bug that happens when you attempt to do too many things at once.