- Uređeno
Speed Up AnimationName Interpolation
When I set an animation using
SkeletonAnimation.AnimationName = "Walk";
it interpolates far too slowly from the current animation to the "Walk" animation. How do I speed up this transition?
This is a very uncommon way of starting animations, which works but is very limited.
You can use the following code instead, if you need to change transition times via code:
Spine.Unity.SkeletonAnimation skeletonAnimation;
var trackEntry = skeletonAnimation.AnimationState.SetAnimation(0, "Walk", true);
trackEntry.MixDuration = 0.3f;
Alternatively, you could also set the mix durations at the skeletonData asset, which is the recommended way to setup animation transition times.
Is it bad that I have this as part of the Update statement? Since it's in Update, setting the track animation keeps the animation frozen on the 1st frame.
How would I set the mix durations at the skeletonData asset?
Ah, I see the mix durations now, I figured it out. Thanks!
I'm not sure I understood you right, but you should not call skeletonAnimation.AnimationState.SetAnimation(0, "Walk", true);
every frame in Update, but only once when switching to a different animation.