- Home /
Question by
Ngoadam123 · Mar 14, 2014 at 09:48 PM ·
animationrandomexecute
Execute Random Animations
How could I execute random animations with variables? I am going to use this for attacking so it executes random animation.
var Animation : String;
function Update (){
if(Input.GetButtonDown("Fire1")){ transform.animation.CrossFade(Animation); } }
Is the current script I use, thanks for the help.
Comment
Best Answer
Answer by getyour411 · Mar 14, 2014 at 09:50 PM
stub
Animation[] animations;
animation[0] = punch
animation[1] = kick
animation[2] = feint
animation[3] = jab
...
animClipIDX = Random.Range[0,animation.Length]
Play.animation[animClipIDX]
Your answer
Follow this Question
Related Questions
Random AudioSource and Animation? 0 Answers
Random animation and InvokeRepeating 1 Answer
Random attack animation 1 Answer
Random Animation of gameObject Children 1 Answer
Random location when clicked on 1 Answer