• Editor
  • Unity, TK2D: Making a TK2D sprite follow a bone from Spine

So here's what I'm trying to figure out, I'm working on an attachment system for some weapons. And I need a way to add attachments that will follow the gun's rotation and position. I've tried using spine attachments and having different images as children of it, and then using SetAttachment or whatever the function is to change what is being displayed. But I need a more efficient and programmatic way to do this. Because when I have 40 weapons, and I want to add a new attachment. I don't want to go into each and every Spine project and add the images that way. I'd rather add the Slot where I want them to go. And then add a TK2D sprite as a child of that Slot/Bone in Unity.

Can I do this?

Thanks.

Related Discussions
...
8 dias depois
10 dias depois
5 dias depois
Nate escreveu

Sorry, I was away. You can add attachments programmatically:
http://esotericsoftware.com/spine-using ... ttachments

It's all good. I did see that doc while I was looking around. But I can't find any of the functions I should use.
I've tried using SetAttachment, but I don't see a way to access RegionAttachment from within Unity.

Do you have any sample code?

RegionAttachments are stored in Skins in the SkeletonData. You can create your own programmatically. See AtlasAttachmentLoader and SkeletonJson for how a RegionAttachment is created and configured.