Animation Events

These bugs in Unity's inbuilt Animation Event system are part of the reason why Animancer Events were implemented. The Events page and Golf Events example compare the differences between the two systems.

Start Event Only Triggers Once

  • Having an Animation Event at time 0 will cause it to be triggered on the first frame when the animation is played.
  • But even if the animation time is later reset to 0 or a negative value, that event will never be triggered again.
  • This issue only occurs when the event time is exactly 0, so you can work around it by using a text editor to open the animation file (or the metadata if it is part of a model such as an FBX file) and changing the event time to a very small value such as 0.00001.
  • Bug Report Case Number: 1230811

Most recent event is not repeated when setting playable time

  • The PlayableExtensions.SetTime method is used to set the time of an animation when using the Playables API.
  • It is supposed to trigger all of the Animation Events between the old and new time during the next frame.
  • However, it fails to re-trigger the most recent event. For example:
    • Imagine an animation with 3 events: A -> B -> C.
    • The animation plays and triggers the events in that order.
    • Then we call SetTime(0) to reset the animation back to the start.
    • During the next animation update it triggers the events again in reverse order, but instead of C -> B -> A it only triggers B -> A.
  • Calling SetTime twice in a row avoids triggering the events, so this bug doesn't really affect Animancer (because we don't want AnimancerState.Time to trigger events anyway).
  • Bug Report Case Number: 1230810

Setting a Playable's time exactly onto an Animation Event triggers it even if the Playable is paused

  • If an animation has an event at time x and you set the time to exactly x, the event will be triggered during the next animation update even if the animation is paused and you call SetTime twice (which is supposed to avoid triggering events).
    • The problem is most easily seen with an event at time 0. When you play something else the old animation is stopped and set back to time 0 which causes the event to trigger even though that animation is no longer playing. In this case, you can work around the issue by changing the event time to a very small value instead of exactly 0 as described above.
  • Bug Report Case Number: 1326589
  • This issue is reportedly fixed in Unity 2021.2.0a1.