Hi there,
This is bugging me since yesterday and I'm unable to understand how to make it work, even after reading other posts and the Mix'n'Match documentation: https://github.com/pharan/spine-unity-docs/blob/master/Mix-and-Match.md
Problem is I'm not a coder per se (I'm using PlayMaker). Anyway, I'd like to combine skins at runtime. "Just" that. :wonder:
At first, I thought it was something as simple as making a naked skin and some outfit skins in Spine, setting at runtime the naked one first and then the chosen outfit one. But it's not working at all.
On more detail, my model has skin placeholders in all the skeleton slots. So in the naked skin, all clothes and props slots have their skin placeholders empty:
Loading Image
...then the outfit skin has all the body skin placeholders empty as well:
Loading Image
(notice that just some outfit slots are used)
So, my expectation was that after setting the naked skin, if I use SetSkin a second time, like this...:
skeletonAnimation.skeleton.SetSkin(skinName.Value);
skeletonAnimation.AnimationState.Apply(skeletonAnimation.Skeleton);
...the runtimes would only add/change attachments that have a non-empty skin placeholder on the skin to be applied to the previous one. But that doesn't seem to be happening. In fact, nothing at all happens: the previous skin is still visible and the attachments from the second one don't show up.
Of course, if I use
skeletonAnimation.skeleton.SetSlotsToSetupPose();
then the whole previous skin gets wiped out and I obtain a floating outfit... :p
And as I've said, I've tried to take a look at the above page and trying to understand, but it seems extremely convoluted for something so apparently simple as this. In fact, I think that in previous runtimes it behaved like I say: adding/changing existent attachments on the second skin, by default, not resetting anything. If that's the case, why the change if we already have the above command to make the skin "new"?
Moreover, wouldn't be far more convenient to implement an optional parameter in SetSkin, to behave in both ways?
Thanks for reading.
Well, it seems that after my first hysterical reaction, I've been able to make sense of the available options detailed in the above link, and Option 1...:
Loading Image
...seems the most sensible solution for my specific case. It's working fine after having modified my PlayMaker action to set skins.
However, what do you think of implementing an option to SetSkin...? Wouldn't that be much better than calling a special function to retrieve the current skin and then making a new one? :happy: