11-6-2019: Spine Mixing Causes Event Dropping

Skeleton Animation objects in Unity by default blend animations together that you have queued on the same track by starting the next animation before the first one is finished.

This was causing the OnEvent triggers we set up in our Spine files (such as “JumpStart”, “AttackEnd”, “Interrupt”) to be ignored at runtime.

Since we mix our animations together on the drawing side, the fix for our case was setting the default mix to 0 for each Spine Asset we are bringing into the game that has events.

There is more information about about handling Spine Events with mixing on the Spine Website.

If you wanted to keep the mixing behavior that Spine provides by default (where animations are blended together with code rather than with drawing), you have to adjust the Event Threshold within a C# script to allow for event reading with one of the settings described below (note: taken from Spine Documentation).

Spine2D User Events During MIxing

A TrackEntry’s EventThreshold controls how user events are treated during the mix duration.

  • With the default value 0, user events stop being raised immediately when the next animation starts playing.
  • If you set it to 0.5, user events stop being raised halfway through the crossfade/mix.
  • If you set it to 1, events will continue to be raised up until the very last frame of the crossfade/mix.

Import a Character into Unity from Spine2D

This video – Spine2D Unity Setup: Søren Juul Øllgaard – shows you how to implement Spine2D characters into Unity.

Spine2D is a 2d animation studio made by Esoteric Software.

For the most part, we animate everything inside of Spine, add events to specific keyframes (see this video about Spine-Unity Events) and then import the Spine Character Model into Unity.

You can essentially control the character’s animations from within any C# Script provided that you insert the correct libraries. You do need to download the Unity Run time library (it can be downloaded here).

There are more tutorials out there on this topic, but the best bet is to look on YouTube.