Wait for animation to finish? Animator.SetBool...

Hey guys, making a simple combo system and I need a way to essentially do…

animation.PlayQueued("AnimName", QueueMode.CompleteOthers)


//Using this
Animator anim1 = etc...;

switch(case)

case 1:
anim1.SetBool("Combo1",true);
yield return new WaitForSeconds(animation in state.length);
anim1.SetBool("Combo1", false);

case 2:
wait for anim 1 to finish ...
anim1.SetBool("Combo2",true);

etc....

Not sure if I can access animations within the animator to get their length?

Should I just stick to the old animation system, or do you guys have any suggestions. Thanks a bunch =)

I’m not sure if I understand your specific question, but I can say that you can access to length of an animationclip.

yield WaitForSeconds (animation[yourAnimation].length)

Hope that helps. If not, good luck anyway :slight_smile:

Edit: Of course, it also works as a Coroutine if using C#.

I made a small package which you can use to wait for animations to start or finish inside coroutines. You can check it out here: GitHub - ComradeVanti/UnityWaitForAnim: A custom yield-instruction for Unity to wait for animations to finish