• Editor
  • What's the difference between "Slot" and "Skin"

Hello there,

Recently, i've posted a beginner question in this forum (viewtopic.php?f=3&t=1353) and Nate give us the solution.
I mean, we planned to use multiple atlases and swap them at runtime when the player changes a piece of gear.

But more we advance deep in Spine, more we realize that there are better ways to do this with spine's features : Slot and Skin
However, we fail to choose between these different features because we don't understand what's exactly the difference between them.

What we want to do :

We have a Character with 5 visual evolutions of his gear (each piece separately) , but keeps the same animation.
In game, player can loot a new evolution of a piece (e.g. new Shoulders) and wear it.

What are the Spine's features to use :

we have 3 choices :

1) use 1 slot by bone with multiple images within and swap the slot's image used at runtime ;

Image removed due to the lack of support for HTTPS. | Show Anyway

2) use several slot by bone with 1 image in each slot and swap the bone's slot used at runtime ;

Image removed due to the lack of support for HTTPS. | Show Anyway

3) use skin ? (it appears that skin is to change ALL images in one step, not only for 1 bone at a time?)

What's the difference between these 3 solutions?
wich would you use ?

Best regards.

Related Discussions
...

I just added a page to the documentation that may help:
http://esotericsoftware.com/spine-runtime-terminology/

There are many ways you could handle your problem.

Keeping items in different atlases causes many texture binds, which can hurt performance. Ideally you would pack everything in one atlas. If they won't fit, possibly you could pack only the images being used into an atlas at runtime. If you are not running on mobile then you probably don't need to use a single atlas.

A slot represents a place where you can attach an attachment. It makes sense to have a "leftHandWeapon" slot and change the region attachment for that slot to change weapons. It would work but it makes less organizational sense to have a slot per weapon image: "mace" slot with a "mace" region, "sword" slot with a "sword" region, etc. You only need multiple slots if you want to show multiple images at the same time, as a slot is only for one or zero attachments at any given time.

Read the link above about skins. Also read here. You will need to use skins if your animations key image changes for attachments that you want to be configurable at runtime. Note you can create and populate a skin dynamically at runtime.

Please ask specific questions if you don't understand any of the above or need me to elaborate. 🙂

Hi Nate and thank you for your help !

It's much more clear now with your explanation.
We' ll try to use 1 slot per bone and put in the 5 images of each armor set evolution, and use "setAttachment" method from the skeleton to change the image (region attachment) of the bone.
As you watch in this example (viewtopic.php?f=3&t=1131) :

RegionAttachment attachment = new RegionAttachment("newhead");
attachment.setRegion(atlas.findRegion("goblingirl/head"));
attachment.setX(0);
attachment.setY(0);
attachment.setScaleX(1);
attachment.setScaleY(1);
attachment.setRotation(0);
attachment.setWidth(64);
attachment.setHeight(64);
attachment.updateOffset();
skeleton.findSlot("right foot").setAttachment(attachment);

This seems very easy to use in this way.

I 'll give you a feed back when we tried in Unity or if we fail to elaborate it :$

But we greatly appreciate your help and advice, thanks a lot Nate !

7일 후

and with this way (from here : viewtopic.php?f=3&t=1409) , we can do whatever we want 😉
we can swap armor pieces even if they need different frames in animations :

slot: head
   skin placeholder: head1
      region attachment: doghead1
   skin placeholder: head2
      region attachment: doghead2
   skin placeholder: head3
      region attachment: doghead3

This software is definitely amazing, thanks a lot Esoteric !!!