0
votes

This is a beginner question that should be available from the first google result but I can't find it.

I have this method that plays an animation using an Animator:

IEnumerator popDownAnimation(string c)
{
    animator = GetComponent<Animator>();
    animator.Play("Pop Down Animation");
    yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !animator.IsInTransition(0));
    animator.Play("New State");
}

Can't remember where I got it from, but yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !animator.IsInTransition(0)); isn't working. It's instantly jumping from "Pop Down Animation" to "New State", so the "Pop Down Animation" doesn't have a chance to play.

1

1 Answers

0
votes

I would suggest using Animation events to do whatever you need. Just remember to make a public method and add the animation event at the end of your animation.