From ec93c6c48face4a84902331f6971bf442f26ebc6 Mon Sep 17 00:00:00 2001 From: Ryan Huggins Date: Sun, 7 Jun 2026 21:19:05 -0400 Subject: [PATCH] Changes intended to improve how RenderSorter handles nested group layers -Do not reset CurrentTileZ when beginning a nested group layer -Do not iterate m_CurrentSortOrder if in a nested group layer -Only reset CurrentTileZ on BeginGroupLayer instead of in both Begin and End --- .../Editor/Importers/RendererSorter.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Importers/RendererSorter.cs b/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Importers/RendererSorter.cs index f8eb1a4b..2e66e4d0 100644 --- a/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Importers/RendererSorter.cs +++ b/SuperTiled2Unity/Packages/com.seanba.super-tiled2unity/Editor/Importers/RendererSorter.cs @@ -46,7 +46,10 @@ public void EndObjectLayer(SuperObjectLayer layer) public void BeginGroupLayer(SuperGroupLayer layer) { - CurrentTileZ = 0; + // Do this before m_GroupDepth is incremented to see if I'm in a nested group + // If I am not, reset CurrentTileZ + if (!IsInGroup()) + CurrentTileZ = 0; m_GroupDepth++; SortingLayerCheck(layer.gameObject); } @@ -54,8 +57,10 @@ public void BeginGroupLayer(SuperGroupLayer layer) public void EndGroupLayer() { m_GroupDepth--; + // Do not iterate m_CurrentSortOrder if in a nested group so layers contine to inherit the sorting order from their parent + if (IsInGroup()) + return; m_CurrentSortOrder++; - CurrentTileZ = 0; } public string AssignTilemapSort(TilemapRenderer renderer) @@ -119,4 +124,4 @@ private void SortingLayerCheck(GameObject go) } } } -} +} \ No newline at end of file