• 수정됨

Hi, this is probably not specific to Unity, as I can reproduce it in Spine editor too.
I discovered that the behavior of MixBlend is different for track 0 and higher tracks. Which is fine, but somehow I thought that the runtime is clever enough that if I am playing animation on track 1 and there is nothing on track 0, the track 1 could behave like a track 0 (means using MixBlend.First)

Because of this, I need to manually call this after setting any animation because the track 0 in our case is often kept cleared:

private void SetTrackEntryMixBlend(TrackEntry trackEntry)
		{
			if (trackEntry.TrackIndex == 1)
			{
				if (skeletonAnimation.AnimationState.GetCurrent(0) == null)
					trackEntry.MixBlend = MixBlend.First;
			}
		}
Related Discussions
...

The behavior of MixBlend in Spine is indeed different for track 0 compared to higher tracks. Track 0 is typically used as the base track, and its animations are applied first, with higher tracks blending on top. If track 0 is empty, higher tracks do not automatically switch to MixBlend.First. To achieve the desired behavior where track 1 behaves like track 0 when track 0 is empty, you can manually set the MixBlend to First for track 1 when track 0 has no animation. Your approach of checking if track 0 is empty and then setting MixBlend to First for track 1 is a valid solution to ensure the correct blending behavior.

AnimationState does indeed special case track 0 here:
EsotericSoftware/spine-runtimesblob/4.2/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java#L215-L216

Also here:
EsotericSoftware/spine-runtimesblob/4.2/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java#L235-L236

It's complex for various reasons. 🤕

Setting mixBlend yourself is OK. If AnimationState did the same, I'm not sure it would behave correctly if later an animation was set on track 0. If you know how your application behaves and that setting mixBlend as you are works, that can make sense.

What is the advantage to having track 0 without an animation much of the time? It may be better to rearrange your app so track 0 is used for "base" animations that are never combined with lower track animations (because there are no lower tracks).

  • abuki 님이 이 게시물을 좋아합니다..