Anyone can help me?
How can i play a random animation eveytime i press a button?
Is this possible?
Ali’s method would work just fine. But a more convenient method would be to use a list
public List<AnimationClip> animations;
void RandomAnim () {
Animation anim = GetComponent<Animation> ();
int rand = Random.Range (0, animations.count);
anim.Play (animations [rand].name);
}
This way you can just add animations to the list, without having to code anything in to make it work.
int Counter;
public void AnimCounter(){
Counter = Random.Rang(1,3);
switch(Counter){
case 1:
//play animation 1
break;
case 2:
//play animation 2
break;
case 3:
//play animation 3
break;
}
}