• Unity
  • Mix / Blend animation states

Related Discussions
...

Hey guys!

My first post! Hi! Hi! Hi! Hi! Hi! Hi!

OK - so I'm currently working on a super fun game being built in Unity. We've currently got animation states blending between one another - but every time we set the duration to 0.1 it seems to revert to a 0.2 setting.

Is this duration set anywhere inside of the .atlas / .json file that's exported out from Spine?

Thanks guys!

E


www.letsbrock.co.uk
twitter.com/letsbrock

The mix duration is stored in the SkeletonDataAsset. If you change it, it should be applied there like any other asset.

But note that mix data is loaded into the non-Unity spine-csharp core at loadtime.
That means changing the asset at runtime doesn't change the duration on the fly.

5 días más tarde

Pharan, is it possible to setup "many -> one" mix durations? Aside from the default mix duration we have a few animations where we'd like to mix to it for a certain duration for any animation it mixes from (using a different mix duration than our default mix duration).

A good example is our damage animation. No matter what the current animation is we always want to mix into the damage animation at a certain duration. This duration differs from our default mix duration.

It's just getting a little cumbersome to manager this with 30+ animations.

You can set the mix duration when you call AnimationState addAnimation or AnimationState setAnimation. Using AnimationStateData isn't a requirement.

TrackEntry entry = state.setAnimation(0, "damage", false);
entry.setMixDuration(0.25f);

That's right. Currently, you can't create a many -> one definition in the mix dictionary.
But you can apply the mix duration when you call SetAnimation.

Like Nate mentioned, but in C#, it would be:

TrackEntry entry = skeletonAnimation.AnimationState.SetAnimation(0, "damage", false); // returns a TrackEntry reference.
entry.MixDuration = 0.25f; // Set the MixDuration property.

Perfect, thanks as always!