• Editor
  • Attaching skeleton on bone slot?

  • Đã chỉnh sửa
Related Discussions
...

Hello, sorry for 2 questions in a row but this feature is really why I switched to Spine from SmoothMoves for.

viewtopic.php?f=3&t=1655&p=8569#p8569
viewtopic.php?f=3&t=1389

I assume this is already implemented in Spine.
Could anyone give me brief workflow on how to do this in both Spine editor and Unity runtime?
Just hints will do and I will research the rest, thanks!

  • Also, how to add/create new skeleton in Spine Editor project? When importing data, I can see several skeletons in the editor but I'm not sure how to add new one without importing.

It is possible, but participating in draw order isn't provided out of the box for spine-unity.

The easiest way is to use a BoneComponent in spine-unity to position a skeleton at another skeleton's bone. The attached skeleton can only be on top or behind though. To participate in the draw order you would need a SkeletonAttachment. This is very simple, just an attachment that has a skeleton:
https://github.com/EsotericSoftware/spi ... t.java#L36
Next you need to augment SkeletonRenderer here:
https://github.com/EsotericSoftware/spi ... er.cs#L127
If it is a SkeletonAttachment then you need to add all of its attachments to the mesh. This would require organizing SkeletonRenderer a little differently.

Add a new skeleton by clicking the logo in the upper left, then New Skeleton.

Thanks. I see where I should start now. Just to clarify,
The skeleton attachment is only implemented in spine-libgdx. I need to write my own code for Unity runtime. And if I do it right, child skeleton attached to another skeleton's bone can also play animation on its own right? ( If it can not be animated, I'd just use images).

Yes, with the approach I outlined, the attached skeleton can be animated.

spine-libgdx has it easier, since when the SkeletonRenderer finds a SkeletonAttachment it can just draw it:
https://github.com/EsotericSoftware/spi ... r.java#L86
For Unity you can't just have it draw another GameObject, so you'll have to arrange things so you can add all of the attached skeleton's region/mesh attachments to the first skeleton's mesh.

That sounds good enough. Thanks again!