Search Issue Tracker

By Design

Votes

0

Found in

2018.1.7f1

Issue ID

1073528

Regression

No

[2D][Tilemap] The Tiles are sorted differently when the Camera moves around the Tilemap

2D

-

To reproduce:

1. Download attached project "tilemapbug.zip" and open in Unity
2. Open "SampleScene" scene
3. Enter Play mode
4. Observe that the tiles are sorted differently when the camera moves around the tilemap

Notes:
- This issue appears both on Windows and OSX
- Video of this issue is in Comments section
- The workaround for this issue would be to create crazy amounts of tilemap layers and it would have a really bad impact on the performance and would not be viable
- The sprite batching should take the grids sorting into account inside a tilemap layer which would stop unwanted sorting glitches

Reproduced on Unity 2017.3.2f1, 2017.4.9f1, 2018.1.9f1, 2018.2.5f1 and 2018.3.0a9
Could not check on Unity 2017.2 because Unity crashes

  1. Resolution Note:

    You could try the following to help with the issue:
    -Create a new Sprite Atlas (Assets -> Create -> Sprite Atlas)
    -Select the Sprite Atlas asset
    -In the Sprite Atlas asset, under Objects for Packing, add all the mountain_* Sprites to this list.
    -Run the test scenario again (Enter Play Mode and watch the Game View)

    The reason why this issue occurs is because all the Sprites in the Tilemap belong to different textures. In order to render each Sprite and have them sorted, each Sprite would have to be drawn individually as the sorting alternates between the mountain_right and mountain_left Tiles. Currently, the TilemapRenderer optimises draw calls by drawing all Sprites with the same texture in a batch where the Sprites in the batch are then sorted according to the sorting order. You could check this out by looking at the draw calls in the Frame Debugger. Using the Sprite Atlas would allow the Sprites be drawn in the same batch, which would also allow them to be sorted together as well.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.