francordoba

Hello! :)

How can I show an attachment that I have already hidden?
_skelAnim = GetComponent<SkeletonMecanim>();
_skelAnim.skeleton.FindSlot("head").Attachment = null;
francordoba
  • Сообщения: 10

Harald

Either by storing it beforehand:
Slot slot = _skelAnim.skeleton.FindSlot("head");
Attachment prevAttachment = slot.Attachment;
..
slot.Attachment = null;
..
slot.Attachment = prevAttachment;
Or query all attachments from a skin:
List<SkinEntry> attachmentsAtSlot= new List<SkinEntry>();
skin.GetAttachments (int slotIndex, List<SkinEntry> attachmentsAtSlot)
You can also query it by name from the skeleton or from a skin:
Attachment attachment = skeleton.GetAttachment (int slotIndex, string attachmentName);
Attachment attachment = skin.GetAttachment(slotIndex, attachmentName);
or in one method:
skeleton.SetAttachment (string slotName, string attachmentName);


---

And as always, please have a look at the API reference documentation pages, there you will find all relevant methods:
API Reference - Spine Runtimes Guide
Аватара пользователя
Harald

Harri
  • Сообщения: 2778


Вернуться в Unity