Why is my sprite sorting behaving weirdly?

These are the same sprites which i’ve placed on different locations in the tilemap, however my sprite sorting is behaving completely differently.

Can someone please help me out with this?

I figured one step towards the solution is that when you place all the ‘Foreground’ or ‘Top’ objects in a single tilemap, all objects you place are grouped together as that one game object.

Therefore depending on the y-axis where you place the same object, the same object gives different results for the rendering order.

I still have no idea how to fix this, but i’m 99% sure that this is causing the issue.

Here’s a concise checklist to resolve sprite sorting issues on a Tilemap in Unity:

  1. Sorting Layer and Order in Layer:
  • Ensure all tiles have the same Sorting Layer and appropriate Order in Layer in the Tilemap Renderer.
  1. Z-Position Consistency:
  • Verify all tiles have the same z-position. Adjust using the Tilemap Renderer’s Mode set to Individual.
  1. Sprite Pivot Points:
  • Confirm all sprites used in the Tilemap have consistent pivot points in the Sprite Editor (e.g., Bottom Center).
  1. Transparency Sort Mode:
  • Set Edit > Project Settings > Graphics > Transparency Sort Mode to Custom Axis with (0, 1, 0) for top-down, or Sort by Y for side-scrollers.
  1. Tilemap Sorting Mode:
  • Change the Sorting Mode in the Tilemap Renderer to Individual for finer control of overlapping tiles.
  1. Parent Object Influence:
  • Ensure the parent GameObject’s z-position or Order in Layer doesn’t conflict with the Tilemap’s sorting.
  1. Consistent Sorting Layers:
  • Use the same Sorting Layer for all related Tilemaps or Sprites interacting in the same scene.
  1. Sprite Atlas Settings:
  • If using a Sprite Atlas, verify it’s set up correctly and isn’t overriding sorting behavior.
  1. Sorting Group Component:
  • Use a Sorting Group component on GameObjects with multiple sprites to treat them as a single entity.
  1. Scene View Debugging:
  • Inspect in Scene View to visualize sorting and layering issues, adjusting Sorting Layers or z-values accordingly.
1 Like

Incredible! Thank you so much. I think what helped the most was setting the tilemap’s render mode to Individual.