Luwenzheng

I just upgraded the spine runtime of my Unity project from 3.5 to 3.6 and i found a problem. Some animations is broken after playing some other animations (playing run animation then idle animation resulting in the idle animation is broken, it seems that not all the bone is updated when changing animation). This does not happen in 3.5. I've attached some screenshots.

Spine 3.5
Spine3_5.PNGSpine 3.5


Spine 3.6
Spine3_6.PNGSpine 3.6


The code used to modify the animation is:
skeletonAnimation.AnimationState.SetAnimation (input.animationLayer, animation, input.loop).TrackTime = (float) inputPlayable.GetTime ();
This code is in MixerBehaviour for unity 2017.1.0 timeline editor which allow scrubbing. The problem happens both in edit mode and play mode.

The project is currently using unity 2017.1.0p5
Luwenzheng
Posts: 2

Pharan

We're currently working on Timeline support but have no set date for it.
But I know the Timeline API is pretty complex and you can't just stick a Spine Animation in there and expect it to work.

What you're doing (SetAnimation for every frame) is actually pretty processor intensive as it will check skeleton property arrangements every frame.

Basically, without mixing, you need to call Skeleton.SetToSetupPose whenever you switch animations. If that's your case, the fix is as simple as that.
If you have mixing, it's more complicated and that's exactly what we're working on now.
User avatar
Pharan

Pharan
Posts: 4364

l6241425

@Luwenzheng how to use spine in timeline?
l6241425
Posts: 1

Luwenzheng

Pharan,

I noticed you're working on the timeline integration on GitHub. I need this feature for the project and can not wait until the end of the year so i decided to hack my way to it.

I don't see to much impact using SetAnimation every frame, maybe I'm overlooking things.
[edit] Just remembered, my code checks the current animation name first before setting the animation. If it is the same animation then it only updates the TrackTime.

I will try to implement Skeleton.SetToSetupPose.
Does 3.5 runtime does the Skeleton.SetToSetupPose automatically? My project is working fine with 3.5.

[update] I tried adding Skeleton.SetToSetupPose before SetAnimation. Problem above is fixed, but there is one frame where the character is broken each time the animation changes. It seems that the skeleton is reset but the animation is not applied on the frame SetAnimation is called.

-- 14 Sep 2017, 10:49 --

@l6241425 I created few scripts to extend the timeline functionality. I followed the tutorial on the 4th video on this blog https://blogs.unity3d.com/2017/06/06/unity-2017-1-beta-feature-highlight-timeline-cinemachine/.
Luwenzheng
Posts: 2


Return to Unity