@britzl Hm, we should really look into fixing that. I think most developers would expect the behaviour described by @Aleksandr_Derbenev.
Your question is exactly what I was looking for! I expected that the z-position of any layer inside a tilemap, is somewhat global, and I could render my dynamically spawned gameobjects in between of two layers of a single tilemap. But that’s not the case!
I thought that material tags and render.predicates might solve that issue. I read about materials and render.predicates. As far as I understand the docs, predicates are only useful for controlling the draw-order of a bunch of components through the render_script. Given that a render.predicate has one tag (which is assigned to two different materials, which in turn are assigned to two separate components), I would have expected that both components would merge into a single draw-call (because of the same material tag). That’s not the case either!
Instead, a render.predicate is basically a selector that says: “draw components with certain material tags before|after others”. This way you don’t need to manage a ton of predicates, but rather sum some of them up to one predicate and manage that.
I ended up splitting my single “game-world-tilemap” into multiple “rooms”. Obstacles like pillars and walls (that I can go behind and in-front) are now each on a separate tilemap. At the end I stitched my world from all these building-blocks and done z-sorting on them when needed.
PS: I’ll see how performance will be, once the map grows. If it drops, I might be able to solve that with collections (chunks of “rooms”), which I’d load and unload at runtime, depending on current camera position…