hj0914

I want the items on the list to be executed in order.

List<string> animation start

var spineAnimationStartNameList = new List<string>{
"animation_name_1",
"animation_name_2",
"animation_name_3",
// AND MORE ANIMATION..
}


skeletonAnimation.state.SetAnimation(0, spineAnimationStartNameList [0], true);
for(var i = 1 ; i< spineAnimationStartNameList .Length-1;i++)
{
skeletonAnimation.state.AddAnimation(i, spineAnimationStartNameList [i], false,1.5f);
}

I want the items on the list to be executed in order.
But, it is being implemented at the same time.

How do I perform in order?
Thanks.
hj0914
Posts: 2

Nate

You are passing i to AnimationState addAnimation. Pass 0 if you want them played on the same track.
User avatar
Nate

Nate
Posts: 8365

hj0914

Thanks!
void PlayAnim()
{
workAnim.gameObject.SetActive(true);
SkeletonAnimation skeletonAnimation = workAnim.GetComponent<SkeletonAnimation>();

skeletonAnimation.state.SetAnimation(0, spineAnimationStartNameList [0], false);

for (var i = 1; i < spineAnimationStartNameList .Count; i++)
{
skeletonAnimation.state.AddAnimation(0, spineAnimationStartNameList [i], false,0f);

}

TrackEntry trackEntry = null;
trackEntry = skeletonAnimation.state.AddEmptyAnimation(0, 0,0);;

trackEntry.End += delegate(TrackEntry entry)
{

workAnim.gameObject.SetActive(false);
Debug.Log("Complete.");
};
}
hj0914
Posts: 2


Return to Unity