Hi guys i’m pretty new to unity, i have 8 animations and i want to put only one button for all the animations.
The goal is to press the button to activate each time the animations one by one.
Example:
i press the button–> trigger animation 1
i press again the button—> trigger animation 2
i press another time the button–>trigger animation 3
thank for you help and have a nice day
If I am not mistaken this is impossible. If I am wrong, please, retify me, it would be interesting for me too.
Try making a float condition and adding +1 every time u press. then when it reaches 8 go back to 0.,Maybe try adding a float condition that adds +1 until 8, then remove -8 on last. and check for the value on the animations
create an animator, create a state for each animation, and make a transition from the default state to the animation and viceversa.
create an int, and set up the condition on each transition leaving the default state, each with a diferent int value, from 0 to the number of animation you have (minus 1)
example:
if you have 3 animation, set 0 for the first animation, 1 for the second and 2 for the third.
now you just need the code:
private int num;
private animator anim;
void Update()
{
if (Input.GetButton("ButtonName"))
{
anim.SetInteger("Int name", num);
num++;
if (num > "place the number of animations -1 here")
{
num =0;
}
}
[link text][1]
best browser