- Edited
How do I represent a lack of attachments in a skin?
I'm trying to use this Mix and Match concept in my game for a wardrobe screen. In my wardrobe screen, I want there to be a skin that's like, "remove earrings." How do I represent that concept in spine?
I was hoping I could create a blank attachment, and then create a "remove earrings" skin, and drag this blank attachment into the "earrings" skin placeholder under the "earrings" slot. But the photoshop script does not export the blank layer, so that doesn't work.
If spine doesn't have a way to represent removing all items of a certain type, won't I have to write my own slot system in Unity? I don't know how else my "remove earrings" button could know which skins are earring skins (to remove them) and which are armor skins (to leave them the way they are).
I think I found a solution, but I don't know if it's a good way to do it: I simply went to the spine images folder and manually created a blank.png. After exporting it to Unity, this "remove earrings" slot seems to do what I wanted. But is this the right way to do this?
Hello! it should be enough to just leave a skin placeholder empty if no image should be present in it given the currently selected skin.
If you want to provide a full-fledged wardrobe system, I would suggest an additive setup where equippable items are combined to a final skin programmatically as described here:
Animation w/ asset change cause asset to vanish on skinchang
And also here:
Unityでの3.7から追加されたスキンの組み合わせ機能について
The setup would then be something like this:
base-skin= "caucasian character in underwear", "african character in underwear", ...
item-skin-earrings="normal earrings", "no earrings", "fancy diamond earrings"
Then the user could remove those earrings by changing the earrings skin from "normal earrings" to "no earrings".
After every item-change, the skin layers are re-combined like layers, as shown in the code in the postings.
I hope that this was not too confusing, please let me know if this makes sense to you.
Is the problem is that you are changing skins at runtime and some attachments are left behind due to the behavior of Skeleton setSkin
? Click that link for a description of the behavior to understand why it happens, as well as a suggestion to use Skeleton setSlotsToSetupPose
.
Harald wroteIf you want to provide a full-fledged wardrobe system, I would suggest an additive setup where equippable items are combined to a final skin programmatically as described here:
Animation w/ asset change cause asset to vanish on skinchang
And also here:
Unityでの3.7から追加されたスキンの組み合わせ機能についてThe setup would then be something like this:
base-skin= "caucasian character in underwear", "african character in underwear", ...
item-skin-earrings="normal earrings", "no earrings", "fancy diamond earrings"Then the user could remove those earrings by changing the earrings skin from "normal earrings" to "no earrings".
After every item-change, the skin layers are re-combined like layers, as shown in the code in the postings.I hope that this was not too confusing, please let me know if this makes sense to you.
So I think base-skin and item-skin-earrings are two lists? If I've got that correct, I understand you. In my code, I would have to build those lists myself, right? That's effectively creating my own slot system in my unity code and I was hoping to avoid this, but it's not the end of the world.
Here's what I'm trying to build:
It'd be really convenient if that whole picture could be generated from Spine data. I could iterate all the skins of that character, and for each skin, I use the skin name on the left and put a button on the right. That I know I could do. But how do I tell if the button should be enabled or disabled? For that, I wish I could check the skeleton and ask, "What skins are active?" It'll say one of those items, so I'll know to disable it. But, I don't know if that's possible.
I've noticed if I say: SetSkin(earrings); SetSkin(no earrings); the last one wins. This would be like the user clicking on the "earrings" button, then clicking on the "no earrings" button. If, after the user does this, I could ask the skeleton which skins are active, if it would return "no earrings," Spine would be doing all the work for me. The only logic I'd need to write is, "Which skins are active? Disable buttons with those skin names." Then, the user could click on any button, and the buttons would enable/disable correctly.
But, I gather that I don't have access to, "What skins are active?" This means I have to make my own concept of slots in my Unity code (e.g., the list of earrings). That's kind of a shame. Spine knows that I can't wear "earrings" and "no earrings" at the same time, but it sounds like I need to duplicate that logic in my code, too?
Let's continue discussing here:
Is there a way to get the active skins from a skeleton?