🧭 TL;DR for Godot 4.4:
If you're using TileMap nodes with tiles from a TileSet, Y-sorting is handled differently now than in Godot 3.x.
Godot 4.4 introduced:
-
A completely overhauled TileMap system
-
Scenes as tiles, layers, and custom properties
-
Automatic or manual Y-sort behavior
🧱 How Y-sorting works with TileSets in Godot 4.4
🧰 Step-by-step setup:
-
Use a TileMap node (not GridMap).
-
Assign a TileSet with tiles that have textures or scene references.
-
In the TileMap properties:
-
✅ Enable Y-Sort under
TileMap > Y-Sort. -
This tells Godot to draw tiles based on their Y coordinate on screen (lower Y behind, higher Y in front).
-
-
Make sure your tiles in the TileSet editor have correct offsets:
-
If a tree is taller than 1 tile, offset the texture so its base aligns with the tile origin.
-
The tile origin is the point Godot uses for sorting.
-
🧠 Important concepts to get right:
🔹 Origin point = Sorting point
Godot sorts by the tile's visual bottom (the Y offset). If you don’t set that correctly, sorting looks broken.
Tip: For tall sprites like trees or houses, shift the texture up in the tile editor so the base of the object touches the tile origin.
🔹 Using Scenes as Tiles
If you're using scenes (prefabs) as tiles:
-
Your scene root should have a YSort node.
-
The TileMap will instantiate these scenes and Y-sorting will follow that node's position.
🔹 Multiple layers
If you're using TileMap layers (e.g., ground, objects, roofs):
-
You can have multiple TileMap nodes (one per layer), each with Y-sorting enabled.
-
Godot does not automatically sort between layers — you must manage layer Z-indices or draw order manually.
🔥 Bonus: Dynamic characters and Y-sorting
Your player sprite (or enemy, NPC) should be:
-
In a
YSortnode -
Positioned in the same Y axis space as your TileMap
-
Then Godot will sort the player in relation to tiles (if all YSort nodes are siblings or in same parent YSort).
✅ What to double-check in Godot 4.4
-
TileMap node has Y-Sort: ON
-
Your tiles in the TileSet have proper offsets and alignment
-
Your visual layers (ground, objects) have proper Z-index if layered separately
-
If using scenes as tiles, their root nodes have YSort
-
Characters exist inside YSort containers and are placed at the same coordinate space as the tilemap
🧪 Want a fast test?
Here’s how to test Y-sorting quickly:
-
Make two tiles: a grass tile and a tree tile (with transparent top).
-
In your TileSet, shift the tree tile up by 32px (so the base is centered).
-
Place the grass and tree tiles on a TileMap with Y-sorting ON.
-
Move your character (in a YSort) behind and in front of the tree.
-
Boom — you’ll see it visually sort properly based on Y.