Search Unity

Animation flicker/glitch/bad-frame occurs at the same time, video included!

Discussion in 'Animation' started by PandaArcade, Jun 3, 2019.

  1. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    During the playback of a UI animation using Mechanim I get a glitch frame where the scale of the element being animated jumps to a very high value for a single frame. You can see it happening a couple times during the following recording. If you keep watching I have appended a slow motion version to make it easier to see.



    There is nothing unusual about my curves.



    To resolve the problem I just change the animation a little and cross my fingers. This occurrence is tough because it doesn't happen in the editor but it does on our test device (iPhone). When I have had it occur in the editor it only happens during playback and not if I scrub through the animation in the animation window.

    I've seen this bug popup a couple of times during our current project but I've never been able to make a simple repo project for a bug report :(

    I'm currently using Unity 2019.1.4f1 but have seeing this bug for a couple months of releases.

    Let me know if you've also seen this bug o_O
     
    Last edited: Jun 3, 2019
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,568
    I assume it's always exactly one frame? Does it happen if you pause the editor and step through one frame at a time?

    It looks like it's happening right at the start of the animation? Maybe check that the time of that first keyframe is exactly 0. Or even set it to a negative value if that's allowed. Or maybe remove it and just let the curve clamp from the value of the second key.

    Have you tried playing the animation with the Playables API? In theory it should be the same because Mecanim uses Playables internally, but in practice there are quite a few differences and bugs that they don't share.
     
  3. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    Thanks for your reply :D

    It is always the same frame. It always occurs on a keyframe.

    Hmm I can't test this atm the moment because in this particular occurance it's only visible in the build.

    It's occuring at the keyframe at about 0:37

    I haven't, I'll have to look into it.

    Thanks :)
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,568
    Since the keyframes are slightly different for each axis, does that mean the broken keyframe on one axis is screwing up all axes at once?

    Try moving them further apart horizontally to determine which one is the problem. Not sure how that would help though. Maybe have a look at the animation file in a text editor to see if something looks corrupted.

    Or add more keyframes and see if it happens for them too.

    You could try some shenanigans with Time.timeScale. Set it to 0, then bump it up to 1 for one frame at a time with each keypress.