- Home /
The question is answered, right answer was accepted
Multiple animation with single button
Hi all, am working android projects. I have 2 buttons one is Up(guitexture) and one is Down(guitexture) and have 6 animations, what i want is if i press my up button once my first animation will play if again press 2 animation will play like 6 animations, my back buttons are same but animation count is reverse 6 to 1.
how can i play this.
Answer by Muhwu · Dec 11, 2014 at 11:14 AM
I think the easiest way to achieve this is to simply (in the animator), make a transition from one animation (state) to another in the order you wish to. Like this (from 1 to 6 and then back to 1):
Anim 1 ---> Anim 2 ---> Anim 3 ---> Anim 4 ---> Anim 5 ---> Anim 6 --
^ |
--------------------------------------------------------------------
Then add a trigger called "Pressed" for example. After that, in your script, just attach a method to your button
public void PressedAnim(){
button.SetTrigger("Pressed");
}
Every time you call the trigger, the animation will then move to the next one.
@$$anonymous$$uhwu, is this for button progress or it will play automatically. Because am having model which contain 6 set of animations, i don't have animator using animation element. Is it possible to do with this?