- Modifié
Hide/Show layer through code
I have a character with several extra layers (hat, gun, jacket, etc) and I want to hide/show certain layers on runtime in Unity through code. Is this possible?
These layers are called Skins in Spine terminology (or Attachments, if it's only a single element).
See this documentation page here:
Skins - Spine User Guide
You might want to take a look at the Goblins
example scene in Spine Examples/Other Examples/Goblins
that is included in the Spine-Unity runtime.
Well, I know about skins. But the same skin with and without a hat is what Im looking for. So may be I need attachments!
Skins are also intended to be used when a swappable item consists of multiple parts, like trousers. There you would create one skin per item.
Note that you can then combine multiple skins (e.g. a base skin and one skin for each multi-slot-cloth-item) to a new one.
You can have a look at this forum thread here for a full fledged wardrobe system (the relevant English translations can be found below the japanese text):
Unityでの3.7から追加されたスキンの組み合わせ機能について
Erika made some nice twitch streams about skins where she created one skin per cloth-item:
Spine Twitch Streams - YouTube
If it's only a single image element, then I would suggest to switch attachments (as described above).