• Editor
  • Unity - How to use Events with SkeetonAnimator?

Related Discussions
...

SkeletonAnimator uses Unity AnimationClip events named after the event name.

All Unity AnimationClip events fire using a SendMessage call.
This works by having any MonoBehavior on the same GameObject have a method name the same as the AnimationClip event.

So if you have an event named "Blink", you can add a method to any script on the same GameObject like this:

void Blink ()
{
     Debug.Log("Blink event was fired");
}
Pharan :

Thank you so much!
I has try this way at first but not work, you make know I have something other wrong. And I find that.

1 年 后
Pharan :

SkeletonAnimator uses Unity AnimationClip events named after the event name.

All Unity AnimationClip events fire using a SendMessage call.
This works by having any MonoBehavior on the same GameObject have a method name the same as the AnimationClip event.

So if you have an event named "Blink", you can add a method to any script on the same GameObject like this:

void Blink ()
{
     Debug.Log("Blink event was fired");
}

@Pharan - OMG I :heart: you!!! This way is 100x easier to use than the SkeletonAnimation workflow, from here:
Coding for Spine Events and AnimationState callbacks

@john - You need to make sure you EVENT is named exactly the same as the method in your script. So if in Spine your Event is called "JohnRun" .. your C# or Javascript method needs to be

void JohnRun ()
 {
  Print("PHEER PHARAN");
 }

If you don't know what a Spine event is. Google it "Esoteric Spine Event"