- Home /
 
               Question by 
               Jordyz96 · Jul 24, 2014 at 10:55 AM · 
                animationjavascriptarrayelement  
              
 
              How to I play an animation using the Animation Element Array via Script?
How to I play an animation using the Animation Elements via Script?
Example: gameObject.transform.parent.animation.Play("AssaultRifleRecoil");
The animation "AssaultRifleRecoil" is in Element 2 in the animation component of the game object.
Is there a way to type the above line of code using the Element Number as opposed to writing the actual string name of the animation?
Example:
    gameObject.transform.parent.animation.Play[2];
The error I get is:
   Assets/Scripts/AssaultRifleScript.js(174,59): BCE0055: Internal compiler error:    Array index is out of range..
But it is obvious not out of range considering that the Element array is all filled with animations up to Element 5
What am I doing wrong?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                