Wait animation1 End before play animation 2

Hello.

i have 2 animations in loop mode, and i want to switch from one to other, after a time that i have chosen in the inspector before play (i created a variable that can be change in number of seconds). I just want that after this seconds, the second animation play but first wait that the other animation finish to play her last cycle until end.

The first animation is 5 seconds long. If i choose that after 6 seconds, the animation must switch, the first animation as begining a second cycle and i want that it finish before playing the second animation…

i looked overall in unity script reference and i didn’t find a call like:
if (animation.lastFrame(“Animation1”){
animation.Play(“Animation2”)…

can somebody help me?

Use “yield WaitForSeconds().”

–Eric

well, for a normal animation ok, but in this one, i need other solution, because the object that have the animation is a buterfly, and i can also change the animation speed, so, in 20 buterflys in botom with all a different speed, i can not know in exactly what moment the animation will end… because, if i put another speed, the during of animation is different…

Animation.PlayQueued

I haven’t done any animating yet, but you can probably use this.

Thank you! That’s in the idea :slight_smile: