This is an update I’ve been waiting awhile for. Recently, Tiled has been updated with better support for Object Types.
Additionally, the Tile Collision Editor now allows you to set properties on an Object Group or Collision basis.
What doess this mean for Tiled2Unity? With earlier versions of the utility it could be cumbersome to manage the different collision types you have on your map. For example, say you had a map in Tiled that contained three different collision types …
Even though all these tiles could be easily placed on the same Tiled layer you would be forced to put them into separate layers, each with a
unity:layer custom property on them, in order for them to be exported to Unity as separate
Spikes collision objects.
Now, with the latest Tiled and Tiled2Unity, you can simply create new types in the Object Types Editor …
… and use those types in the Tile Collision Editor …
… and the collision tiles will be combined into
PolygonCollider2d objects of the same type for you automatically …
This is done without the need for a custom
unity:layer property. Note that the
unity:layer property is still obeyed however if used. This is useful if you have a special Tile Layer that you want to force into a particular collision type.
Note that in order to see the collision type colors in the previewer that you will need to point Tiled2Unity to an Object Types XML file. I suggest you export that file (from the Object Types Editor in Tiled) to the same folder you keep your maps in and keep it updated.
Default Object Type Properties Exported Too
Many users won’t need to worry about setting the Object Types XML when exporting their Tiled maps. However, if you want default properties to be exported with any Tile Objects to be consumed by a Custom Importer then you will need this setting.
Note: For Tiled2UnityLite users (Mac and Linux) you will want to pass the path to your Object Types XML as a command line option. For example:
Tiled2UnityLite.cs -o=/Your/Path/To/objecttypes.xml $TMXPATH $UNITYDIR
Tiled2UnityLite.cs --object-type-xml=/Your/Path/To/objecttypes.xml $TMXPATH $UNITYDIR
Bug Reports Always Welcome
I like to think I do a pretty good job of testing new features added to Tiled2Unity, but, because of reasons, the magnitude of this update is larger than normal. If you experience odd behavior or a fatal crash please send me an email so I can be aware of it.