Search Issue Tracker

By Design

Votes

1

Found in

2017.3.1f1

Issue ID

1014358

Regression

No

TilemapRenderer sorting order is not consistent with different images

2D

-

How to reproduce:
1. Open given Unity project
2. Enter "Woods Level 2" scene
3. Open the Tile Palette
4. Select "Bush" tile in the Tile Palette (bottom left)
5. Draw in the scene

Expected result: All drawn tiles should be sorted equally but not randomly
Actual result: Drawn tiles are sorted randomly

Reproducible with:2018.2.0a2, 2018.1.0b11, 2017.3.2f1, 2017.2.2p1

Note:
Cannot test on 2018.2.0a3 and newer versions because of tile palette bug

  1. Resolution Note (2018.3.X):

    The reason why this occurs is because the Bush Tile is made up of 3 Sprites that come from different Textures. The default rendering in TilemapRenderer prioritizes rendering Sprites in the same Textures and batching them together to reduce the number of Draw Calls, before sorting the Tiles. This can be verified by looking at the Unity Frame Debugger to see how the Sprites are drawn.

    To help with this issue, the Sprites used in the Tilemap can be atlassed to a single Texture so the sorting can happen. To do this:
    -Create a Sprite Atlas in the Project Window
    -Select the Sprite Atlas asset
    -In the Sprite Atlas inspector, add the Bush Sprites under Objects to Pack
    -In Project Settings/Editor, ensure that Sprite Packing is enabled (Always Enabled)
    -Enter PlayMode and observe the BushTop Tilemap

    Alternatively, with the soon to be released 2018.3 version of Unity, enabling Individual mode rendering for the TilemapRenderer would allow for individual sorting and rendering of the Sprites instead of batching them up together statically.

Comments (3)

  1. wladyslaw

    Sep 28, 2018 16:24

    POSSIBLE SOLUTION
    Seems like this can be easily helped by using a Sprite Atlas. See the answer to the linked question: https://gamedev.stackexchange.com/questions/154980/unity-order-issue-with-tilemaprenderer-render

  2. wladyslaw

    Sep 28, 2018 16:24

    POSSIBLE SOLUTION
    Seems like this can be easily helped by using a Sprite Atlas. See the answer to the linked question: https://gamedev.stackexchange.com/questions/154980/unity-order-issue-with-tilemaprenderer-render

  3. wladyslaw

    Aug 22, 2018 12:48

    Could be related to the issue described here: https://gamedev.stackexchange.com/questions/154980/unity-order-issue-with-tilemaprenderer-render
    There is some interesting info about Draw Dynamic event.

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.