• Runtimes
  • Some sprite dissappear in Unity when I use skins

I don't know where to place this question: in Editor or in Runtime.

So, here is the thing. I have a skeleton that uses 3 skins. I have 4 skin placeholders. But all of them needed only on skin 3. In skin 1 and skin 2 I use only 3 placeholders and the 4th remains empty. And here the bug appears. The sprite using in 4th placeholder in skin3 disappears on Unity. if I place some sprite i this 4th placeholder in skins 1 and 2 and make them transparent, then everything is ok. But I have a lot of other skeletons where the number of placeholders is a lot more different in different skins, so it is pain to fill them with sprites and set them opacity 0.

Is there any other way to fix that?

I use 3.8 runtime and Spine 3.8.94

Related Discussions
...

As you have observed correctly, not messing with the previous null-state of slot.attachment is the default use case which is covered by Skeleton.SetSkin:

"Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode attachment is attached from the new skin."

Nevertheless, you should be able to quite easily attach all attachments of a skin ignoring which attachments were active before via the following code:

void AttachAllEvenInactive (Skin skin, Skeleton skeleton) {
   foreach (Skin.SkinEntry entry in skin.Attachments.Keys) {
      int slotIndex = entry.SlotIndex;
      Slot slot = skeleton.Slots.Items[slotIndex];
      slot.Attachment = entry.Attachment;
   }
}