Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Transition interruptions not resetting state time

Discussion in '5.2 Beta' started by illegaldogs, Sep 3, 2015.

  1. illegaldogs

    illegaldogs

    Joined:
    Oct 27, 2014
    Posts:
    1
    I handle characters attacks, moves etc. with coroutines and AnimatorStateInfo.normalizedTime, with code like this:

    while (stateInfo.normalizedTime < 0.3f)
    PlaySFX();
    while (stateInfo.normalizedTime < 0.5f) yield return null;
    CheckForHit();

    The stateInfo gets updated separately in Update(), using GetCurrentAnimatorStateInfo, or if we're in a transition, GetNextAnimatorStateInfo.

    All my move states come out of a central idle state, with no transitions between the individual moves. Combos/spamming of moves works through interrupts, with all transitions set to allow interrupts from the NEXT state. So if the player hits "punch" while transitioning out of a previous punch, the punch->idle transition gets interrupted by the new idle->punch transition, which also starts the punch state again from 0 time.

    This all worked perfectly until the 5.2 beta. Now, using the same code and animator, when I try to do the above interruption, it does transition to punch again but the normalizedTime doesn't seem to restart from 0, and the new coroutine just runs through its entirety in the same frame.

    Is this a bug? Suggestions welcome.