Mitch escribióSadly this isn't a trivial problem heh; I've been thinking of a few ways to solve it involving submesh renderers and using the DrawOrder of a given slot to influence Unity's "Order in Layer" property for z sorting. Its ugly and complicated though.
I agree. Not only is it non-trivial, but I think this specific use case adds further complexity. I'm guessing the character is the prime asset (root object) and the canons are subordinate. If it were the other way around I would suggest an empty slot in the canons animation to draw the character. As it is now... well... yeah.
You need to literally interleave two animations.
[EDIT] : The following is not possible because of how draw offsets are handled.[/EDIT]
I think a general solution is as follows: create a container (SkeletonList/Renderer) that collects all the slots from all the animations that it contains and sorts by *submission order and *spine-draworder.offset.
Your animations in Spine can use negative and positive draworder.offsets, and still retain a relative order. The trick is to use [a Stable Sorting Algorithm, such as BubbleSort] when merging the draworders. Add the new draw orders to the end of the list and [stable]sort.
Loading Image
It's a general solution because it doesn't require any specific renderer or runtime to operate. SkeletonList would automatically collect and sort slots when an animation is added to it or during an update() phase (is there a draw order timeline)? Then, instead of iterating the slots in the skeleton, you iterate slots in a skeleton list.
Unity would need a little more work as you would need to add the Spine Animation to the SkeletonList/Render instead of to the scene graph. But for this user case, the SkeletonList would be the root object and they could add/remove skeleton animations as they wished.
Mitch escribió
This functionality is all in the runtimes if you want to leverage it. Take specific note of how asterisks * are used to generate new mesh renderer passes.
I've only seen the submesh '*' trick rendering in Unity. I checked the other renderers and could not find it. It's dependant on how a renderer works, Unity uses a scene graph which does a lot of sorting and render state optimizations. A lot of other renderers issue render commands immediately.