• Unity
  • How to check when the animation ends?

  • Düzenlendi
Related Discussions
...

Hi.
I'm struggling with it for a while.
Could you please help with relevant code example?

I have skeleton and its animation name:

public SkeletonAnimation playAfterSkeleton;
[SpineAnimation(dataField: "playAfterSkeleton")]
public string _afterAnimation;

I need to launch some function once the exact animation of this skeleton gets to the last frame.

I read the documentation. And still a lot is unclear. The example is not relevant for me because I try to catch End/Complete from another class. I mean what I have is a link to SkeletonAnimation. I need to know when some animation of this skeleton is complete. Any more examples?


Well, I figured it out. Thanks!


One more question: what if animation is looped? It seems End or Complete don't work in such case. How to know when looped animation got to a last frame?

Once one loop is completed, the "Complete" event is emitted.

8 gün sonra

In case anything remains unclear, please note that there is separate tutorial page "Spine Events and AnimationState callbacks" linked from the spine-unity documentation page, in case you missed it:
Coding for Spine Events and AnimationState callbacks