godotengine / godotengine/godot

TileMap ScenesCollections tiles ignore y-sort origin of layer they are placed in.

Open
#89,927 3 comments 0 reactions 0 assignees View on GitHub
bug discussion topic:2d topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

-Reproducible in 4.3dev5.

### System information

Windows 11 - Godot v4.3dev5 mono - Vulkan (Forward+)

### Issue description

Scenes used inside a TileMap as a ScenesCollection completely ignore the y_sort_origin set for the layer they are placed in. Their y sorting is only affected by the base node's y position.

It is expected that scenes placed inside of a TileMap would respect the y-sort origin like any other tile. Because their y-sorting cannot be directly accessed in order to sort them correctly their origin and texture offsets would have to be individually modified; however, SceneCollections cannot even have their variables accessed inside of the TileSet so this is impossible (and even then if the TileSet is reused inside multiple layers with different y-sort origins this doesn't even help).

### Steps to reproduce

1. Create a TileMap with y_sort_enabled = true.
2. Create 2 Layers inside of this TileMap with y_sort_enabled = true.
3. Create a Sprite2D scene and give it a texture.
4. Create a TileSet inside of the TileMap that has a grid_size smaller than the sprite scene so tiles will overlap.
5. On one of the layers inside the TileMap change the y_sort_origin to be larger than the grid's y size.
7. Inside the TileSet create a new ScenesCollection tile and add the sprite scene.
8. In the TileMap Editor place the new tile on both layers.
9. Note that tiles inside the layer with a higher y_sort_origin value still appear behind the other layer when placed in the cell above.

### Minimal reproduction project (MRP)

[BugReportMRP.zip](https://github.com/godotengine/godot/files/14764796/BugReportMRP.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the linked BugReportMRP.zip and follow the reproduction steps using a TileMap with two y-sorted layers and a ScenesCollection tile. Compare the ordering of the placed scenes between layers, then make the scene collection respect each layer's y_sort_origin and verify the reported overlap case.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.