There is an Non_Loop animation.
My case is 『Stop and hide the animation that maybe doesn't arrive the end frame. Next time I have to show and play it in first key frame. Then I will repeat it at same mode. 』 ! But I have a serious problem. First time playing animation is OK. And then I hide it. Next time when I show it , the animation is flash first then play the animation. My understanding the animation must return to setup pose then play animation ? How do I reslove it ? AnimationState.ClearTracks and skeleton.SetToSetupPose , but it doesn't work.
using Spine3.7 runtime and Unity 5.6.7
below is my code! Using ShowSpine() and HideSpine() ! And I use spine-example-demo animation to try and record it !
private Transform _trans_obj;
private SkeletonAnimation _spine_sa;
...
_spine_sa = _trans_obj.GetComponent<SkeletonAnimation>();
...
public void ShowSpine()
{
if (_trans_obj)
{
_trans_obj.gameObject.SetActive(true);
if(!_trans_obj.gameObject.activeSelf) _trans_obj.gameObject.SetActive(true);
_spine_sa.AnimationState.SetAnimation(0, "sneak", false);
}
}
public void HideSpine()
{
//_spine_sa.AnimationState.ClearTracks();
//_spine_sa.skeleton.SetToSetupPose();
_trans_obj.gameObject.SetActive(false);
}
below is my record video.
https://gyazo.com/a6bee0878916457254ac9a8130275c3b
3rd second is show and play animation first time then
4th second is SetActive(false) to hide it .
5th second is show it and play it again. And the animation flash first and then play animation.
Thank you