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

Bug Some animator states will restart after a couple of frames (creating a visual glitch)

Discussion in 'Animation' started by Mic_Emond, Sep 22, 2022.

  1. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    Hey ! I have a situation where I have 3 states for an attack sequence (windup, action, recovery).
    The states are linked together with 1 transition which has:

    Exit Time = 1
    Transition Duration = 0

    And no other conditions.

    In Play Mode, 99% of the time, the action phase will start playing, then after a couple of frames, will restart from the beginning, causing the animation to "rewind" and creating a visual stutter. Same for the Recovery animation.

    When just stepping (ctrl + alt + p), the issue happens only 1% of the time.

    Here's a gif of it running at normal speed (it's quick, more noticeable on "recovery" in the gif):
    animatorBug.gif

    Here is stepping in editor:
    animatorBugSteps.gif

    This is also noticeable in build. There is no code calling these states. It's not just a state machine visual bug, I can see the character also going back and glitching in the scene.

    Anybody with the same issue ?
    Any fix or insight would be greatly appreciated :)
     
  2. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    For anyone having this issue:
    I've done a lot of other tests.

    The only thing that fixes it for me is having
    EXIT TIME = 0.9
    TRANSITION DURATION 0.1
    (although I'd have preferred not having any transitions)

    Anything with EXIT TIME = 1 can trigger the issue