0
votes
private IEnumerator reviveCountdown() {

    timeLeft = 5;
    while (timeLeft >= 0) {
        reviveAnim.ResetTrigger ("AdReviveTrigger");
        reviveAnim.SetTrigger ("AdReviveTrigger");
        reviveCountdownText.text = timeLeft.ToString();
        yield return new WaitForSecondsRealtime(1.0f);
        timeLeft--;
    }
}

I'm using the above IEnumerator to show a timer that counts down from 5 to 0, and animates the text each time it counts down. The countdown works correctly. The problem I'm having is the animation IS TRIGGERED but never actually plays because it gets stuck on the animation state, as shown in the screenshot below. It sits in the AdRevive state for the entire 5 seconds but never plays. The transition from Idle is a simple trigger set in the code. The animation works if I play it manually in the Unity editor. Anyone know why it gets stuck? enter image description here

1

1 Answers

0
votes

I solved my own issue. The Time.timeScale was set to 0 because the game was paused during this animation, so it would never play. To fix, I set the animationUpdateMode to UnscaledTime.