UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

graphics

[Tilemap] Eliminate Isometric Sprite Overlaps with Correct Depth Sorting

Solution

graphicsrenderingoptimizationtilemaps2D

Unity 2021.x - Unity 6.3.x

Published Sun, Mar 15

Issue

 Tiles within an Isometric Tilemap exhibit unexpected overlapping artifacts. This occurs despite configuring the Transparency Sort Axis (e.g., Y = -0.26) and setting the Tilemap Renderer mode to Individual. Adjustments to tile pivots and Isometric Z as Y settings often fail to resolve these visual discrepancies when tiles originate from multiple source textures, leading to rendering inconsistencies in the 2D environment.

Explanation

The root cause of depth sorting discrepancies in an Isometric Tilemap is often the use of individual sprite files for each tile instead of a unified spritesheet. When the Tilemap Renderer batches these separate textures, it can fail to calculate the correct draw order relative to the Transparency Sort Axis because the assets reside on different texture layers.

  1. Consolidate all individual tile graphics into a single PNG image to create a spritesheet.
  2. Import your spritesheet into Unity and set the Texture Type to Sprite (2D and UI).
  3. Open the Sprite Editor and slice the spritesheet using a consistent pivot point (e.g., Bottom for isometric tiles) to ensure the engine anchors every tile correctly.
  4. Create a new Tile Palette and populate it by dragging the sliced sprites from your spritesheet into the palette window.
  5. Assign the new tiles to your tilemap and set the Tilemap Renderer mode to Individual to force the engine to sort tiles based on their pivots rather than batching them into static chunks.

Additional Tips

  • Set the Transparency Sort Mode to Custom Axis in Project Settings > Graphics and verify the axis is set to (0, 1, -0.26) for 2:1 tiles.
  • Ensure the Orientation property on the Grid component is set to Isometric or Isometric Z as Y to match your perspective.
  • If artifacts persist, check that your spritesheet does not have extraneous transparent padding that exceeds the tile boundaries, as this can confuse the depth calculation.

TL;DR

Consolidate individual sprite assets into a single spritesheet to fix depth sorting. Construct the Tile Palette using sliced sprites from a unified texture to ensure consistent batching and rendering.


Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.