• Unity
  • Spine,Change Layers in Unity

Hi There,
on the SkeletonData component, you can enable/disable slots individually, and on SkeletonAnimation component, you can set the sorting layer.
my question is... is there a way to set a different sorting layer to one specific slot? I know there's only one MeshRenderer for the object, but maybe each slot is reading the mesh renderer's layer and is assigned by that? so maybe it could be overriden?
Thanks.

p.s. the runtime Spine I'm using is 3.8

Related Discussions
...
  • 編集済み

There are a couple ways to handle sorting:
1) Set the default Sorting Order in Spine
2) Animate the Sorting Order by keying it in Spine in an animation
3) Using the SkeletonRenderSeparator component in Unity: spine-unity Runtime Documentation: SkeletonRenderSeparator
If you decide to try out the SkeletonRenderSeparator, my suggestion would be to create a super simple Spine project solely for testing out the Separator so you learn how it works. Even though it's relatively straightforward, you basically need to test it out a bit to understand what is going on.
4) Keep in mind that if using the SkeletonRenderSeparator, then in Spine you can adjust the "Separator Slot" Draw Order within Spine animations (keying the Draw Order), if needed.

Thanks again for answering @Jamez0r! 8)

rudra00 wrote

but maybe each slot is reading the mesh renderer's layer and is assigned by that? so maybe it could be overriden?

Please note that Unity limits sorting functionality here, as each MeshRenderer can have only a single sorting layer assigned. You can work around this limitation by using a SkeletonRenderSeparator component as mentioned above, splitting a single skeleton into multiple MeshRenderers.

By default, the spine-unity SkeletonRenderer component just assigns a mesh at its MeshRenderer component, you can then set properties of this MeshRenderer component as desired. There is no additional "sorting layer per slot" logic possible without using multiple MeshRenderers.

If you just want to change draw order of slots inside a single skeleton, please see Draw Order in the Spine documentation, as mentioned by Jamez0r above.