• Unity
  • AddAnimation Starting Before Previous Animation Complete

I just upgraded my Unity project to 3.7.

My newest animation is giving me trouble.

When I call:

skeletonTop.state.SetAnimation(0, "KrakenTentacleDownTop", false);
skeletonTop.GetComponent<MeshRenderer>().sortingLayerName = "Foreground";
skeletonTop.state.AddAnimation(0, "KrakenTentacleIdleBase", true, 0f);

The "KrakenTentacleIdleBase" animation starts before the "KrakenTentacleDownTop" animation completes.

However, if I comment out the AddAnimation, the KrakenTentacleDownTop animation finishes without issue.

I've compared this by testing both while going frame by frame in Unity.

I'm not sure what to do about this, aside from switch to tracking state.Complete and then SetAnimation myself from there. I would prefer to be able to get AddAnimation to queue properly.

Have you re-exported your Spine assets from a 3.7 Spine editor version, or have you only upgraded the Spine-Unity runtime version to 3.7? Please note that 3.6 assets are not compatible with 3.7 runtimes.

In case you haven't already seen it, here you can find a 3.6 to 3.7 upgrade guide:
Spine-Unity 3.6 to 3.7 Upgrade Guide

Yes, the animation was exported from Spine 3.7 and I am running the Spine 3.7 SDK in Unity (I know because it broke all of my animation state logic for the animation of another boss, which wasn't covered in your upgrade guide).

4 days later

Could you please provide us a minimal project that still shows the problem and send it to contact@esotericsoftware.com? Then we can have a look at the issue.


Thanks for the reproduction project!

It looks as if the problem is the DefaultMixDuration:

This parameter is set to 0.2s in your project, but the animation itself to transition from KrakenTentacleDownTop is only 0.267s long and switches between different enabled images (which cannot be interpolated by e.g. 70% of ImageA + 30% of ImageB as bone-driven animation). If you set the DefaultMixDuration to 0 it will play the animation properly.