Search Unity

Animation events not always firing - 5.5.0p4

Discussion in 'Animation' started by zzzzzz789, Feb 14, 2018.

  1. zzzzzz789

    zzzzzz789

    Joined:
    Dec 21, 2013
    Posts:
    22
    Hey Unity Animation team,
    After searching the forums I couldn't find the exact answer to this.

    We are running Unity 5.5.0p4 in our production environment (we cannot upgrade further for this game). And some testers on device are observing some inconsistent behavior for animation events in legacy animations.

    Given Thread1 / Thread2 - it seems there were fixes going in for Animation Events as recent as early 2017.

    Do you know if there are any Animation Event bug fixes we are missing with our version of Unity? (5.5.0p4)
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    We didn't fix any animation events bug in legacy since 4.0 if I remember well, we know that some event may not fired consistently when they are close to the end of the clip due to some floating point precision error. We did try a few time to fix this issue but it turn out that it does introduce new regression that are worse so we had to rollback the fix.

    The only workaround that is know to work is to move the animation event a few frame before the end of the clip to avoid the precision bug.
     
    zzzzzz789 likes this.
  3. zzzzzz789

    zzzzzz789

    Joined:
    Dec 21, 2013
    Posts:
    22
    We have experienced the issue you mentioned with Animations Events near the end of a Legacy Animation Clip. Our workaround currently is to put our cleanup / game logic Animation Events on the final frame of the clip... and change the WrapMode to ClampForever. Any thoughts on this work around or knowledge where this wouldn't work?

    Additional follow up - given you said Animation Events are not consistent 'close to the end of a clip' - when does that 'close to the end' start to apply? Can we safely assert that an Animation Event in the middle of a clip is safe and will always fire?

    We are looking for guidance on whether we can use Animation Events for important game logic - or can we only use Animation Events for non-critical events like playing a sfx?
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    We are talking about floating point precision issue here so the error could affect one frame at max, so yes events in the middle of a clip should always be fire if you play the whole clip.

    I can't garantee that your workaround does work as I never made this test my self.
    Setting your animation events of the last frame for critical events can be problematic in some case,so I would move them one frame before the last one to avoid the precision issue.
     
unityunity