• Unity
  • How to combine 2 skins in unity?

Related Discussions
...

Hello! Help me please to combine 2 skins randomly. There are 2 skins (Cyber and Human). I need that attachments in Skins placeholders switching automatically. Ill tried many ways to do that, but I'm not a programmer. The official documentation is very hard for me.
Thanks.

Did you have a look at the example scenes in Spine Examples/Other Examples named Mix and Match, Mix and Match Equip and Mix and Match Skins?

Harald escreveu

Did you have a look at the example scenes in Spine Examples/Other Examples named Mix and Match, Mix and Match Equip and Mix and Match Skins?

Yes. Method AddAttachment() didn't work.
I done something like

_randomSkin.SetAttachment(15, "Eye_r", _cyber.GetAttachment(15, "Eye_r"));

I that right way?

What is ExposedLIst? How i can get slot or slot name from exposedList by index?

You don't use an index directly, you should instead query the index once as shown in the example scene code here:

int visorSlotIndex = skeleton.FindSlotIndex(visorSlot); // You can access GetAttachment and SetAttachment via string, but caching the slotIndex is faster.

Then you can use the returned index in SetAttachment() as shown a few lines further down:

customSkin.SetAttachment(visorSlotIndex, visorKey, newAttachment); 

What is ExposedLIst? How i can get slot or slot name from exposedList by index?

You can access the content at an index via exposedList.Items[index], so skeleton.Slots.Items[index]. Most likely you won't need it here.