If you just want to queue two animations one after another, that's what AnimationState.AddAnimation
is for.
Otherwise...
An Animation object has a Duration
property. By default, that is the time value in seconds between the start of the animation, and the time of the last key.
When you play an animation using SetAnimation
, it returns a TrackEntry. A TrackEntry keeps track of the time progress (metaphorically, its playhead) of a playback of animation. This is the TrackTime
property of TrackEntry.
A TrackEntry has a Complete
event you can subscribe to. It raises Complete when AnimationState detects that its TrackTime went beyond its Duration. If the animation loops, this happens every loop.
TrackEntry trackEntry = skeletonAnimation.AnimationState.SetAnimation(0, "dance", false);
trackEntry.Complete += YourCompleteHandler
You can read more about using events here: Coding for Spine Events and AnimationState callbacks
If you don't want to use events, you can manually check the TrackEntry's Animation.Duration against its TrackTime every frame.