arkhampy

Hi Pharan, Mitch o Nate.
I have in my Spine project an empty slot named "stuff", now in Unity I want to add/attach a GameObject to that slot "stuff", there is a way to do that?
I have try with skeletonAnimation.skeleton.AttachUnitySprite but only work with Sprite.. and I want to add/attach a GameObject.

Regards,
Kullanıcı avatarı
arkhampy
  • Mesajlar: 47

Pharan

You don't need a Slot for this. You just need a bone, and use the BoneFollower script/component.

Basic use:
(1) Give your skeleton a Bone (called "stuff"). Export from Spine. Import into Unity.
(2) Instantiate your SkeletonAnimation.
(3) Create your "Stuff" GameObject. Reparent the "Stuff" Transform to be the child of the SkeletonAnimation's Transform.
(4) Add the BoneFollower script to the "Stuff" GameObject.
(5) Set the BoneFollower's boneName to the bone you want it to follow. You can use the inspector so you can pick from a list, or you can set it through code.
(6) Start the game. Enjoy.

There are advanced uses but this will get you going.
You can also use SkeletonUtility and spawn a follow hierarchy. That's a bit heavier in terms of calculations but I think allows you to do more stuff(?)
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

arkhampy

Thanks you a lot Pharan
Kullanıcı avatarı
arkhampy
  • Mesajlar: 47


Dön Unity