I’ve spent countless hours trying to find a solution. My current approach is placing placeholder tiles and running a function to replace them with actual scenes when the level loads. While this method ensures proper y-sorting, it raises performance concerns on larger tilemaps.
I was hopeful that the new tilemap layers in version 4.3 would offer a solution, but after experimenting with them, I haven’t been able to get them to work as either.
Manually placing the scenes is of course an option, but aligning them and managing the scene tree becomes tedious and time consuming.
Y-Sorting seems to work for me with TileMapLayer Scene Collections. My map scene tree looks something like this:
Map
Camera2D
Objects (Node2D with Y-Sort enabled)
TileMapLayer (with Y-Sort enabled)
Other Nodes
When the game is run, the scene collection tiles get spawned as children of the TileMapLayer with random fun Godot names (@Node2D@37). I didn’t do thorough testing though.
Which in hindsight clearly doesn’t make sense. However, i did try your approach during my relentless testing in 4.2 a while back, which did not work iirc, so unless I’m misremembering, this is new to 4.3
Anyways, my current setup is as follows, and it works:
Scene
Map (y-sort enabled)
TilemapLayer - Layer 0
TilemapLayer - Layer 1
TilemapLayer - Props (y-sort enabled)
Player
Enemy
Enemy…
Other nodes…
As im writing this, It did occur to me that a simpler way to do this (for my usecase) would be like this, and after testing, it works just as well:
Scene
Map
TilemapLayer - Layer 0
TilemapLayer - Layer 1
TilemapLayer - Props (y-sort enabled)
Player
Enemy
Enemy…
Other nodes…
But thank you very much for the assistance, this had been bugging me for the better part of a month!