• Unity
  • Events and gameobject disabled in spine animation

  • Modificato
Related Discussions
...

Hi,

I have animations in unity that use events (in animation editor) and disable gameobject during the animation.

Is there a way to use spine animation instead of unity animation and do the same thing ?

One simple example : during a spine animation I want to run a method in unity and disable a gameobject.

Ty !

When using the SkeletonAnimation component, you will receive Spine events which can be set in the Spine Editor as described here:
Events - Spine User Guide

You then subscribe your event method to skeletonAnimation.AnimationState.Event like this:

skeletonAnimation.AnimationState.Event += HandleEvent;
..
void HandleEvent (TrackEntry trackEntry, Event e) {
    ..
}

You can have a look at the example scene Spine Examples/Getting Started/2 Controlling Animation that comes with the spine-unity package on how to write a small script to react to an event with playing an audio sample.

Documentation can be found here on the spine-unity documentation pages:
spine-unity Runtime Documentation: Processing AnimationState Events