06 July 2014
Hi there! Tiled2Unity is no longer in development nor supported. Use SuperTiled2Unity to import Tiled Map Editor maps into your Unity projects instead.
The best received feature in Tiled2Unity is the ability to build up collision geometry from the tiles you lay down — but it only supported creating a
PolygonCollider2D from rectangle and polygon objects. With the release of Tiled2Unity 0.9.3.0 (download latest Tiled2Unity here), support has been extended to polylines which are represented as
EdgeCollider2Ds in Unity.
The most obvious use of this feature is for the type of one-way collision that you find in so many old 2D platforming games. That’s cool but I’ve put together a different kind of example that takes the moving platforms from Mega Man 2 (yes, again with the Mega Man references) and shows how they could be implemented with help from Tiled2Unity.
These platforms move along a charted path and seems like a great use for the
EdgeCollider2D class in Unity — but having to draw out that path by hand would be a total pain. Instead, we’re going to add polylines to the tiles that make up that platform path and have the Tiled2Unity exporter create the
EdgeCollider2D object for us. This way we could change the visuals of the path and the physical colliders would automatically update to match.
We start off with the
platform-map.tmx file in Tiled …
Just like we’d add polygons and rectangles to tiles in Tiled we can add polylines using the Tile Collision Editor.
After adding all the polylines to all the “path” tiles we can launch Tiled2Unity and preview the results …
That path gets built into one continuous EdgeCollider2D component with 44 vertices which is exactly what we wanted. The example comes with a
Platform sprite which is programmed to traverse that path (see the custom
And we’re done. Send questions to me via the comments or email. Happy developing.