From 8d3350b34fc70ed30261f103bd514e0a38fc3d8c Mon Sep 17 00:00:00 2001 From: Benjamin Cutler Date: Mon, 19 Sep 2016 22:07:08 -0600 Subject: [PATCH] attach custom props from objecttypes.xml to generated collision layers --- .../Tiled2UnityLib/ExportClasses/TiledMapExporter.Prefab.cs | 2 ++ tool/Tiled2Unity/Tiled2UnityLib/TmxClasses/TmxHelper.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tool/Tiled2Unity/Tiled2UnityLib/ExportClasses/TiledMapExporter.Prefab.cs b/tool/Tiled2Unity/Tiled2UnityLib/ExportClasses/TiledMapExporter.Prefab.cs index 56db7a4..d9c4e26 100644 --- a/tool/Tiled2Unity/Tiled2UnityLib/ExportClasses/TiledMapExporter.Prefab.cs +++ b/tool/Tiled2Unity/Tiled2UnityLib/ExportClasses/TiledMapExporter.Prefab.cs @@ -122,6 +122,8 @@ private XElement CreatePrefabElement() foreach (var collisionLayer in layer.CollisionLayers) { var collisionElements = CreateCollisionElementForLayer(collisionLayer); + AssignUnityProperties(collisionLayer, collisionElements, PrefabContext.TiledLayer); + AssignTiledProperties(collisionLayer, collisionElements); layerElement.Add(collisionElements); } } diff --git a/tool/Tiled2Unity/Tiled2UnityLib/TmxClasses/TmxHelper.cs b/tool/Tiled2Unity/Tiled2UnityLib/TmxClasses/TmxHelper.cs index edcfabf..3d27283 100644 --- a/tool/Tiled2Unity/Tiled2UnityLib/TmxClasses/TmxHelper.cs +++ b/tool/Tiled2Unity/Tiled2UnityLib/TmxClasses/TmxHelper.cs @@ -147,6 +147,10 @@ public static TmxProperties GetPropertiesWithTypeDefaults(TmxHasProperties hasPr { TmxObject tmxObject = hasProperties as TmxObject; objectTypeName = tmxObject.Type; + } else if (hasProperties is TmxLayer) + { + TmxLayer tmxLayer = hasProperties as TmxLayer; + objectTypeName = tmxLayer.Name; } // If an object type has been found then copy over all the default values for properties