If you're using SkeletonAnimation
, it uses Spine.AnimationState
.
Spine.AnimationState
has a Start
event that fires every time a new animation is played so you don't have to keep track of that yourself. That's the ideal place to bind a method that calls mySkeletonAnimation.skeleton.SetToSetupPose()
.
That way, it'll always reset unkeyed channels (and not inherit the final pose from previous animations).
I've been calling this "auto-reset" in the forums in case you want to do a search. It's not something Spine assumes you want, but it does mimick how the animations switch in Spine editor, so I assume it's what many people expect.
Your code would look something like this:
void Start () {
var skeletonAnimation = GetComponent<SkeletonAnimation>();
var skeleton = skeletonAnimation.skeleton;
skeletonAnimation.state.Start += delegate { skeleton.SetToSetupPose(); };
}
I'm not 100% sure if this breaks mixing. I think it doesn't, except that parts that aren't keyed would reset their transform immediately instead of mixing. Do test it out and see.
One thing this doesn't do though is reset the pose in iterations of looping animations if for any timeline that you animated, you don't have a key at frame 0. So make sure you always have those for looping animations.