I want to display particles mixed up with sprites (some in front, some behind).
Naturally, I gave particles the same predicate as sprites, but then something strange started to happen: some particle systems are displayed entirely on top of the sprites and some behind. It’s completely unclear what affects what. And what to do about it?
Ok, please, can you just tell me how exactly the particles get into the sprite batch? Having that knowledge would solve all the problems.
I am not 100% sure this will be useful, but some time ago, I achieved what you are trying to do and I can more-or-less remember how.
My technique involved having two particle FX emitters in the game object, one behind the GOs and one in front of them, and playing both of them at the same time. You need to change the predicate (or possibly the material? I can’t remember what worked now), and then look into emitter space, and the z-layer of the particle FXs.
I don’t think I went any deeper than that in order to get everything working.
Aha!
But since the sprite batch is still split by Z, the emitter with its particles ends up somewhere in the middle there. I see.
So I shouldn’t count on particles and sprites interleaving. Sad but not fatal.
It would be nice to (in the future), to be able to share vertex buffers across component types and collections. A first (tiny) step towards that is we want custom vertex format support for our components.