fengmin Unfortunately, I'm not sure why the crashes occur, but I think Harald will answer that later.
Anyway, I think there are some solutions. For example, you can modify the code to register a handler for the End
event of the TrackEntry and call AddEmptyAnimation()
beforehand so that the animation returns to the setup pose when it is complete.
Spine.TrackEntry trackEntry = attackAnimator.SetAnimation(0, "attack", false);
trackEntry.End += AttckAnimalComplete;
animationState.AddEmptyAnimation(0, 0, 0);
This way, the End
event is fired when the animation switches to the empty animation, so it is sufficient to simply register a method to the End
event. This allows you to cover both the case where the animation is complete, and the case where the animation is switched to another before it is complete.