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
- Spring Joint shows only one anchor gizmo in Scene view when "Auto Configure Connected Anchor" is enabled
- Crash on _platform_memmove after entering large value in Graphics settings Preloaded Shaders field
- Disproportionally large impact on CPU frame time when writing to a rendering entity's LocalToWorld
- "Constant Force" Component numeric fields drift out of view while entering a really big value in the Inspector
- Scene view camera speed pop-up appears empty or cut off when Scene view is very narrow
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.