Thanks for the reply.
It seems setting TrackEntry to loop does not help as the original animation is already set to loop.
To clarify when you use SetAnimation on every frame, you'll only see the first frame of the animation.
I guess I could use a cached reference to the animation, it would look like the following code example.
The question I have now – is there a way to avoid having two variables for one animation? Like I'd love to serialize Spine.Animation straight away.
public class AnimationLoopTest : MonoBehaviour
{
[SerializeField] SkeletonAnimation skeletonAnimation;
[SerializeField]
[SpineAnimation(dataField: "skeletonAnimation", fallbackToTextField: true)]
string animationName;
Spine.Animation spineAnimation;
void Start()
{
spineAnimation = skeletonAnimation.skeleton.Data.FindAnimation(animationName);
}
void Update()
{
if (skeletonAnimation.AnimationState.GetCurrent(0).Animation != spineAnimation)
{
skeletonAnimation.AnimationState.SetAnimation(0, spineAnimation, true);
}
}
}