-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
When using a non infinite map, the output applies the unity:layer correctly In this example my map is non infinite and when importing it works correctly setting the layer of the object with the PolygonCollider2D to the layer "Wall" as expected.

However when toggling the map to infinite and doing map chunks, the layer is no longer applied and the layer is instead set to Default

Current workaround is to copy the layer down using a custom importer.
using UnityEngine;
using SuperTiled2Unity;
using SuperTiled2Unity.Editor;
public class InfiniteTerrainLayerFix: CustomTmxImporter
{
public override void TmxAssetImported(TmxAssetImportedArgs args)
{
SuperMap map = args.ImportedSuperMap;
foreach (Transform grid in map.gameObject.transform)
{
foreach (Transform gridLayer in grid)
{
Layer setLayer = gridLayer.gameObject.layer;
foreach(Transform chunk in gridLayer.transform)
{
foreach(Transform collider in chunk.transform)
{
if(collider.GetComponent<PolygonCollider2D>() != null)
{
collider.gameObject.layer = setLayer;
}
}
}
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels