Let me take a step back and quickly outline how the skeleton hierarchy works. A skeleton is composed of one or more bones. A bone may have zero or more bone children. A bone may also have zero or more slots. Slots are locations in a skeleton to which attachments can be attached and thus made visible. A slot can only have a single attachment attached at a time.
So, to make an attachment invisible, you have to find the slot it is attached to, and then set the attachment on the slot to null
. Assuming you know the slot the attachment is attached to, it's as simple as:
skeleton.findSlot("slotName").setAttachment(null);
Note that calling skeleton.setToSetupPose
, skeleton.setSlotsToSetupPose
, skeleton.setSkin
as well as having attachment timelines may attach the attachment to the slot again.