Hello!
We are currently using Spine Unity and I feel that our setup is quite bit complex.
Just to summarize what we want to do :
- Having a character that can equip a helmet for his back view and face view with different visibility based on the sprite
- Having a character that can equip a cloak that is a mesh so it moves properly with all sprites with different visibility also based on the sprite
Here is two screens of the back and face view and what we want to achieve :
We got a character with 2 views (face and back) with only one skin. The animations are responsible to show the appropriate parts of the character.
I started to implement helmets on my character which :
- has a slot for the back view
- has a slot for the front view
There is no attachment there. I create it on the fly using code when the player wants to equip helmet.
Works quite well. On my side, I keep the attachment and the slot to hide/show them when the animation direction chnages (by simply setting the attachment of the slot to null)
I started then to implement a way to control the visibility of the sprite. I made a custom editor and everything is working fine. I implemented a way to automatically add the SkeletonPartsSeparator and the needed parts renderer =>
- so we got 0 for the main sprite (the character
- 1 for the fst
- 2 for the snd
I discovered that the components that are rendered might change depending on the DrawOrder and various things. I just implemented something to tweak the sorting order based on the configured visibility of the sprite so its part renderer is always having the good sorting order.
Now comes the silly part. We added some cloaks for the player in a different way. We used a big sprite with a 0 alpha so its completely invisible. It's a MeshAttachment so it can move properly and so on when the player equips a cloak.
This way, everything is working fine as well.
I realized that setting the attachment of the slot to zero was not enough since it was not an attachment created on the fly and was part of the skeleton data. I then updated my script that was removing attachment to the slot to also set the alpha to 0 when we move direction or the cloak is removed.
But now, I'm facing a problem : since one of the alpha is zero, the submesh instructions for the SkeletonPartsRenderer is kinda different. It misses slots and moves the way I setup my parts renderer.
So my question is basically : is there something wrong with our setup? Can we do something better in term of workflow?
Of course I could tweak parts by code : for example, if it's a MeshAttachment I'll just have to skip the creation of two parts renderer but it feels a bit cumbersome. Also, should I have to just remove the parts renderer when the equipment is totally removed (the player removes the cloak) and recreate them on the fly?
Everything I can think of feels like workarounds and not real solutions to my problem.
Hope you can help me to find the best solution!
Thanks you