This was requested a few times before so we stuck the feature into Spine-Unity.
It's not as efficient as it could be yet (Mitch used an extra non-rendering Material to hide certain parts, which breaks batching and may cause a few useless draw calls) but it works.
Here's a sample from when it was first implemented:
In this sample, the raptor skeleton was rendered in the middle of the hero's skeleton.
WARNING: OUTDATED INFO (Feb 2015)
Right now, the way to tell SkeletonRenderer to split the rendering in two is go to Spine and add an (empty) slot named *
or starting with an asterisk, like: *particles go here
. Then put it in the right place in the skeleton's Draw Order.
In Unity, this will cause it to generate an extra GameObject with a MeshRenderer on it.
Then you set the Sorting Layer and Sorting Order accordingly so the back part is drawn first, then inserted parts (like your particles) and then the front part. You'll need an extra script or something to do this, since Unity doesn't expose it in the inspector.
Despite being hidden in the inspector, all Renderer
s since 4.3 actually have .sortingLayerID
, .sortingLayerName
and .sortingOrder
properties that can be changed and it will behave correctly. Read more about them in the docs: http://docs.unity3d.com/ScriptReference/Renderer.html
Though I vaguely remember the particle renderer acting a bit differently. In that case though, that would be a Unity thing and it wouldn't work even if you were to use two different skeletons.
PS
Alpha-blended shaders like the one Spine-Unity uses don't write to the depth buffer so using zSpacing can never be used for the effect you're looking for (ie, to tell it what parts should be drawn behind or in front in other objects).