Search Unity

Bug Animator transition Delay

Discussion in 'Animation' started by Jakeiiii, Nov 23, 2021.

  1. Jakeiiii

    Jakeiiii

    Joined:
    Jul 7, 2014
    Posts:
    270
    My animator has a Jump animation that can either transition to a Falling animation or a Landing animation. The transition to the Falling animation relies on "Has Exit Time" and automatically plays at the end of the Jump animation if the character hasn't landed.
    However, the transition to the Landing animation does not have "Has Exit Time" enabled and is instead reliant on a parameter that gets set to "true" when the character lands. By this logic, as soon as it's set to "true" it should run trigger the transition immediately, but is instead waiting for the Jump animation to finish. Yes, I have double-checked that "Has Exit Time" is unchecked and I have even removed the Jump-to-Falling transition just to make sure it wasn't interfering.
    Are there any other variables that could affect the time an Animator Transition gets played?

    Thank you.
     
  2. Jakeiiii

    Jakeiiii

    Joined:
    Jul 7, 2014
    Posts:
    270
    So I've decided to switch things up to try and isolate the issue.
    The Jump animation state is now on its own with no transition from/to it. The Landing animation is played via a Trigger parameter from Any State.
    Even now when the Trigger is set in the code, it remains enabled in the Animator window (the Trigger's radio button is filled) and doesn't start the transition until the Jump animation has finished playing.
    As far as I'm concerned, this transition from Any State to Land should happen immediately as the Trigger gets set. Could this be a bug?

    Using Unity 2021.2.1f1 by the way, which I already know has a buggy Animator window.
     
  3. Jakeiiii

    Jakeiiii

    Joined:
    Jul 7, 2014
    Posts:
    270
    Alright, so this seems to behave like a bug.

    Whatever changes I try to make to the Animator have no effect. However, during Play Mode, if I make a change to some setting in the Animator (e.g. change the Interruption Source of the transition, remove a transition somewhere, change the Fixed Duration toggle of a transition, whatever) then the issue disappears and the Trigger fires the transition immediately. However, once exiting Play Mode, whatever changes I make, or have made, are meaningless and the issue resurfaces.

    These are the Jump animation state and Land animation state:
    upload_2021-11-25_13-45-42.png



    This is the Any State -> Land transition:
    upload_2021-11-25_13-39-45.png



    This is the Land Trigger parameter and the Jump state a frame before the Trigger gets set:
    upload_2021-11-25_13-41-16.png



    This is the frame that the Trigger gets set:
    upload_2021-11-25_13-42-38.png

    And this is 13 frames later when the Trigger finally takes effect:
    upload_2021-11-25_13-45-59.png

    And so now, for example, if I pause the game and turn off "Write Defaults" for both animation state and set "Fixed Duration" on the transition to "false" then the issue disappears! But then if I exit Play Mode, apply these changes, and then play the game again, the issue happens again even with these new modifications.


    EDIT:
    Setting the "Can Transition To Self" bool to "false" on the transition seems to help in the sense that this issue happens on the first Land -> Jump during gameplay but then doesn't happen for every other jump thereafter.
    And for the record, the Trigger is only being set once per land.
     
    Last edited: Nov 25, 2021
  4. Jakeiiii

    Jakeiiii

    Joined:
    Jul 7, 2014
    Posts:
    270
    Ah I've given up on this and have just used Animator.CrossFade("Land") instead. Still, there's an obvious issue with the Animator and, in Unity 2021.2.1f1, the grid in the background of the Animator is offset and my Mouse Cursor selection boxes are also offset.

    In another project I've opted to just have single Animation States with little-to-no transitions and just Cross Fade through code. I find the Unity Animator to just be way too messy, inconsistent, and too prone to conflicts and unwanted behaviours.
     
unityunity