In Spine-Unity, "Updating" consists of calling Animation.Apply
to pose the backend Skeleton
object, letting it update internally, then updating the Unity mesh by letting SkeletonRenderer interpret that new pose.
You can make an Editor script that calls Animation.Apply
to pose a skeleton, and then calling SkeletonRenderer/SkeletonAnimation's LateUpdate
. (We were arguing about this a bit before but LateUpdate
is actually just SkeletonAnimation's unabstracted Render/UpdateMesh/RenderSkeleton method that has an unfortunate name.)
Animation.Apply
takes a time parameter so you can control the time yourself, and maybe make an edit-mode time keeper.
SkeletonAnimation
's Update that relies on Time.deltaTime just relies on Spine.AnimationState
to do the timekeeping. You should be able to do that yourself without too much trouble since what really makes Spine.AnimationState
complicated is its queueing and mixing features.
Everything you need is deserialized and exists in Edit mode so you can do all this.
Here's the order in which you should do the calls:
//lastTime is a float. It's used to detect fired events. Pass 0 if you don't need events.
//the last parameter is a List<Spine.Event>. You can pass null if you don't need events.
YourAnimation.Apply(skeleton, lastTime, time, loop: true, null);
skeleton.UpdateWorldTransform();
skeletonRenderer.LateUpdate();
Also remember that Spine.Skeleton
s don't automatically reset so you have to call skeleton.SetToSetupPose()
whenever you have bones that have unwanted leftover poses from previous animations.