Search Unity

Animator random delay when using Triggers

Discussion in 'Animation' started by Reeley, Mar 30, 2020.

  1. Reeley

    Reeley

    Joined:
    Feb 23, 2017
    Posts:
    45
    Im using a trigger to transition form one into another state. The problem im having is that the state switch has some random delay and is not instantly triggered, when the trigger is set.

    Here is a quick video of the behaviour, you can see the transition settings on the right.


    If i uncheck the exit time the state will change instantly, but the grab animation should always play till the end. Also if the trigger is set before the animation is played to the end, the state will change instantly.
    If the trigger is set after the animation reaches its end there is this random delay. It looks like the animator doesnt inform the transition about the updated trigger.
     
  2. vargata

    vargata

    Joined:
    Nov 26, 2013
    Posts:
    120
    I see this is an old issue, I revive it because it clearly persists. I have the same problem with the transition between 2 very simple animations. If I remove exit time, one can be interrupted with the other, if i set exit time, after one animation ended, when I try to trigger the other one, there is a 1-3 seconds random delay... if I set the trigger during one animation then the transition is instant and there is no delay, only if i let it end

    btw, if you still read this, have you found any solutions?
     
    Last edited: May 2, 2021
  3. vargata

    vargata

    Joined:
    Nov 26, 2013
    Posts:
    120
    Interesting... Nobody every uses animations that have to run to its end before the next transition can be activated? This is a 10 years old issue persisting, I thought there might be a simple solution I just can't find
     
  4. Novlek

    Novlek

    Joined:
    Jun 3, 2019
    Posts:
    1
    @vargata have you been able to find a solution to this?

    I'm dealing with the same issue. I need to transition to the next state at the end of a state that requires has exit time and player input.

    It just looks like unity keeps playing the animation in the background without updating it on screen, generating a random delay between input and transition.

    @anyone please help.
     
  5. vargata

    vargata

    Joined:
    Nov 26, 2013
    Posts:
    120

    Hi there. yes I was able to solve but I cant really remember. I have found this in my old code

    Code (CSharp):
    1. public bool hasFinishedAnimation {
    2.         get { return (myAnim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1 || myAnim.GetCurrentAnimatorStateInfo(0).normalizedTime <= 0); }
    3.     }
    Im not sure but I think i used this as condition to run an animation