Spine error: Attachment not found, for slot
- spine-ts (web, Phaser, PixiJS)
Attachment not found: sword-2, for slot: weapon— Skeleton.setAttachment- spine-csharp (Unity)
Attachment not found: sword-2, for slot: weapon— Skeleton.SetAttachment
Thrown by setAttachment(slot, attachment) in game code. The runtime looks the attachment up in the active skin, then in the default skin, by the attachment's name in the skin — not by the image path — and throws if neither has it for that slot.
Why it happens
- The attachment lives in a skin that is not active yet: call
setSkinByNamebeforesetAttachment. - The image path was used instead of the attachment name. The name is the key under the slot in the skin; the
pathfield is only for the atlas. - The attachment belongs to another slot: names are per slot, the same name in another slot does not count.
How to fix it
skeleton.setSkinByName("knight"); // the skin that has "sword-2"
skeleton.setAttachment("weapon", "sword-2"); // slot name, attachment nameTo clear a slot, pass null as the attachment name — that is allowed and does not throw.
Check your skeleton
The Spine JSON validator does not look for this one, but checks the rest of the file for the problems the runtime loads silently — slot colors, mesh data, deform keys, bone order. It runs in your browser.