(Not sure if this really is a Bug or I am just using the API in a wrong way)
I want to start an animation
- With a MixDuration (but without a previous TrackElement on the same track)
- With a time offset (start the animation at frame X > 0)
What I Did:
- Installed spine-unity-3.8-2019-09-05
- Opened the [2 Controlling Animation] Example Scene
- Modified the DoDemoRoutine() in SpineBeginnerTwo.cs to the following
[Range(0.0f, 1.0f)]
public float offsetRelative = 0.0f;
IEnumerator DoDemoRoutine ()
{
while (true) {
// just for better ovservability
Time.timeScale = 0.2f;
// As advised in http://esotericsoftware.com/spine-applying-animations#Empty-animations
spineAnimationState.SetEmptyAnimation(0, 0);
// We want to start with an offset (as advised in http://esotericsoftware.com/forum/Is-Spine-Animation-has-cycle-offset-for-looping-animation-6621 )
var track = spineAnimationState.AddAnimation(0, walkAnimationName, true, 0.0f);
track.TrackTime = offsetRelative * track.AnimationEnd;
track.MixDuration = 0.01f; //< just for better observability
yield return new WaitForSeconds(0.2f);
// Reset to idle
var track2 = spineAnimationState.AddAnimation(0, idleAnimationName, true, 0);
track2.MixDuration = 0.01f; //< just for better observability
yield return new WaitForSeconds(0.2f);
}
}
What I expected:
- The Run Animation starting on different frames depending on offsetRelative
What I observe:
- The Run Animation does not consider the offset, I put into TrackTime
- When I change the AddAnimation() calls to SetAnimation() the offset works as expected, but SetAnimation() seems to not support the MixDuration from the EmptyAnimation
Is this a bug or am I doing something wrong?