I'm leaving this info here since it's kind of an FAQ for people using Events.
These are in terms of C# since that's what I use and callback systems vary across different programming languages, but similar behavior on Spine's side can be found across all runtimes.

Spine.AnimationState is where you subscribe to events:
Event is for user-defined events that you key in Spine editor and is saved in Spine skeleton data.
Start is for whenever AnimationState starts playing a new Spine.Animation.
Complete and End can be a bit confusing though, so here's what they're really for (plus a warning):

Complete only fires when an animation finishes playing to its full duration, and in the case of looping, in each loop.
Cases include:
  • the end of each loop, and
  • when an animation finishes playing.

End fires when an animation finishes playing (not at every loop) but also when an Animation is changed or gets interrupted, even if it doesn't finish playing its full duration.
Cases include:
  • when an animation finishes playing,
  • when an animation is changed midway (SetAnimation can cause End to fire), or
  • when an animation is stopped/cleared.

Bonus info:
Because of this, End is a bit dangerous. You should never bind a function that calls SetAnimation on End.
It'll do an infinite recursion (and cause a stack overflow) because SetAnimation causes End to fire when it interrupts a currently playing animation. It's fine to do it with Complete and Start.

In some ways, it's a bit of a misnomer because End fires even if it doesn't reach the end of the animation. :p
Originally posted here: viewtopic.php?p=17418#p17418

A new and improved source of this information can be found here: Spine-Unity Events and Callbacks Documentation
User avatar
  • Posts: 5366

Return to Off-topic