Help with "IndexOutOfRangeException: Array index is out of range."

Hello,

I am using Playmaker 1.7.7, Smooth Moves, and Unity 4.6. I believe that it is interfering with my character’s movement as I cannot get the FSM to respond to key presses, i.e. when a key is pressed it will not move to the next state. Can some one please tell me what this error means and how to correct it? I must include that it did work before but for some reason it is no longer working. I cannot get my players to respond to any commands given by keyboard. Please let me know if I am not being descriptive enough with this post. This issue has halted my progress.

IndexOutOfRangeException: Array index is out of range.
SmoothMoves.BoneAnimation.get_Item (System.String animationName)
SmoothMoves_PlayAnimation.DoPlayAnimation () (at /Users/macuser/Desktop/backup 1/Assets/PlayMaker/Actions/SmoothMoves_PlayAnimation.cs:83)
SmoothMoves_PlayAnimation.OnEnter () (at /Users/macuser/Desktop/backup 1/Assets/PlayMaker/Actions/SmoothMoves_PlayAnimation.cs:55)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()

Thanks in advance

Probably better for another forum (scripting, etc).

I know nothing about PlayMaker, but what your first error is (and possibly causing some/all of the others), is that something in your code is trying to access an element that doesn’t exist in an array.
So basically lets say you have an array of numbers with 5 elements. To access the five elements your code would be arrayName[0] for the first number, arrayName[1] for the second … and arrayName[4] for the fifth element (since the index starts at 0 the final index will always be one less than the total number of elements the array can hold). If something in your code tried to access, for example, arrayName[5] or arrayName[10] etc. it will throw an error during run-time. Hope this helps shed a little light.

1 Like

The error is thrown by the Smooth Moves Play Animation action. I’d guess from the error that it’s looking for an animation name that doesn’t exist… I would check your animation names, and also contact the author of Smooth Moves to add some error checking to the action.