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
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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.