diff --git a/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/Loaders/SuperObjectLayerLoader.cs b/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/Loaders/SuperObjectLayerLoader.cs index 36cbf49b..5e26b37b 100644 --- a/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/Loaders/SuperObjectLayerLoader.cs +++ b/SuperTiled2Unity/Assets/SuperTiled2Unity/Scripts/Editor/Loaders/SuperObjectLayerLoader.cs @@ -40,7 +40,12 @@ public void CreateObjects() if (drawOrder == DrawOrder.TopDown) { // xObjects need to be ordered by y-value - xObjects = xObjects.OrderBy(x => x.GetAttributeAs("y", 0.0f)); + xObjects = xObjects.OrderBy((x) => { + float m_X = x.GetAttributeAs("x", 0.0f); + float m_Y = x.GetAttributeAs("y", 0.0f); + var localPosition = ColliderFactory.TransformPoint(new Vector2(m_X, m_Y)); + return localPosition.y; + }); } foreach (var xObj in xObjects)