Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    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.