Koopa Yao

Hi, I am a newer to Spine(V3.6) and encounter a problem, hope someone can help me.

I export two atlas from spine, one is for 'Idle' animation and one for 'Run' animation. The two animations are so different so I can't make them in one atlas.
When load them into unity(V5.6), I get two skeletonDatas.
In Spine example projects, all animations are in one skeletonData, it is easy to change the animation by function 'SetAnimation'.But in my case, I can't do it like that.I have two SkeletonAnimation objects and I want to know if there is a way to display one SkeletonAnimation object while hide another, then according the input to switch them.

Any advice is welcome! Thanks!

-- 10 9月 2017, 05:21 --

Hi,
I find a way by myself.
In the function 'Start()', I will create two SkeletonAnimation objects and put them far away(for example Vector3(100000, 100000)), then move the idle SkeletonAnimation to the vision of camera.
When enter the Key 'A' or Key 'D', I can change the idle SkeletonAnimation to run SkeletonAnimation and move the idle one far away.
I also think about another way that I can create one SkeletonAnimation in first and destroy it with create another one when there is a input.But it maybe not efficient.
Does anyone else has other good ways, please tell me.Thanks.
Koopa Yao
Posts: 9

Pharan

Are you new to Unity?
Yes, one SkeletonAnimation per SkeletonData is best.

You can enable and disable GameObjects.
Instead of moving object far away, just disable it using gameObject.SetActive(false).
https://docs.unity3d.com/ScriptReference/GameObject.SetActive.html
User avatar
Pharan

Pharan
Posts: 4502

Koopa Yao

Hi Pharan,
I am also new to Unity and thanks for your advice, it works well.
Koopa Yao
Posts: 9


Return to Unity
cron