Tiled2Unity: Tiled Support for Unity

Tiled on Patreon Support Tiled Map Editor on Patreon
Please consider supporting Tiled Map Editor on Patreon. Tiled is a free and essential tool for 2D game development and I’d like to see the author support it and similar tools fulltime.  We’d have no Tiled2Unity without it.

Tiled2Unity Downloads

Tiled2Unity is a free utility with one goal in mind: Easy exporting of Tiled Map Editor TMX files into your Unity projects. Tiled2Unity takes your Tiled files and creates Unity prefabs from them that are easily placed into your Unity scene. Complex collision is supported through Unity’s PolygonCollider2D class. (Windows and Mac)

Tiled2UnityLite is a command line version of the Tiled2Unity utility. It can be used on any platform but was primarily designed to give Linux users a way to use Tiled2Unity on their operating system.

Updating Tiled2Unity

When you install a new Tiled2Unity version you will also want to update the Tiled2Unity scripts in your Unity project folder as well. The easiest way to accomplish this is through the Import Unity Package to Project menu item while your project is open in Unity.

Easily update your Tiled2Unity scripts

Note: Both the Tiled2Unity output window and the Unity console will complain if there is a mismatch.

All Source is Freely Available on GitHub

Tiled2Unity is made up of two parts:

  1. The Tiled2Unity utility that exports a Tiled file.
  2. The Tiled2Unity Unity scripts that imports the *.tiled2unity.xml files and puts the textures, meshes, and prefabs into your Unity project.

Both components are publicly available on GitHub.

Tiled2Unity on GitHub

Learning Tiled2Unity

I’ve tried to make Tiled2Unity simple to use and understand. Here’s some links that may help you out:

  • Introduction: Use the test TMX files supplied with Tiled2Unity to create two simple scenes in your Unity project (one with sloped collision).
  • Tiled2Unity Scale: By default, Unity 2D sprites use a coordinate system where 100 pixels equals 1 unit in Unity. I think that’s crazy but this link will show you how to live in that world.
  • Mega Dad Adventures: A good number of “advanced” examples of using Tiled2Unity in your Unity projects. Set tags and layers on your imported prefabs and add custom, game-specific behavior.
  • Tile EdgeCollider2D Support: Shows you how you can use polylines in the Tile Collision Editor to export EdgeCollider2D objects in your Unity prefab.
  • Getting Tile Information at Runtime: Useful for Strategy and RPG style games.
  • Introducing Tild2UnityLite: Use Tiled2Unity as a command line utility on PC, Mac, or Linux.

Feel Free to Contact Me

If you’re making something with Tiled2Unity I’d love to hear about it. I also welcome bug reports with big hugs — although my real life schedule may keep me busy at times. In any case, email me your suggestions or awesome stuff.

Tiled2Unity Version History

Version 1.0.8.0

  • Bug Fix: Isometric Tile Objects that are scaled are exported to the proper position.
  • Bug Fix: Simplified depth buffer calculations on Tile Layers and Object Groups to reduce z-fighting

Version 1.0.7.10

  • Bug Fix: Fixed bug with polyline objects of 2 vertices being rejected during export.

Version 1.0.7.9

  • Bug Fix: Tile Objects are ordered by y-position when exported, similar to Tiled.

Version 1.0.7.8

  • Bug Fix: In some cases, polyline objects were not being exported properly as EdgeCollider2D objects.
  • New Feature: Color and File property types from Tiled now supported.

Version 1.0.7.7

  • Bug Fix: Tiled2UnityMac was crashing under some conditions when loading a TMX file.
  • New Feature (Advanced): Use -w or --writeable-vertices command line option to create Tiled map meshes that can be manipulated through script. Note: This increases the memory used by the mesh significantly.

Version 1.0.7.6

  • Bug Fix: Animation fix for when multiple animations loop at different times.
  • Bug Fix: Stretched Tile Objects collision offsets set correctly now.

Version 1.0.7.5

  • Bug Fix: Animation frames can be on different images now.

Version 1.0.7.4

  • Bug Fix: Fixed math on texture coordinates for rotated tiles (was causing seams)
  • Bug Fix: Isometric tiles that were added to Tiled as a collection of images were being placed incorrectly in generated prefab
  • Bug Fix: Clear Object Types button Tiled2UnityMac was not hooked up.

Version 1.0.7.3

  • Bug Fix: Decomposing polygons into convex groups would sometimes throw an exception in the triangulation stage.

Version 1.0.7.2

  • Bug Fix: Exporting Tiled files that reference “internal textures” (i.e. textures already part of the Unity project) has been fixed.

Version 1.0.7.1

  • Improved Feature: Vertex Scaling was replaced with “Pixels Per Unit” so that it mapped exactly with what Unity is using to scale sprites.
  • Bug Fix: Fixed exception when importing textures that used an alpha color key.

Version 1.0.7.0

  • Bug Fix: Maps that were referencing the same texture were being invalidated upon export.
  • New Platform: Tiled2UnityMac is now available. Mac users can now use Tiled2Unity in the same way that Windows users have long enjoyed.

Version 1.0.6.0

  • New Feature: Can now use depth buffer shaders in cases where you want a sprite to draw above or below a tile depending on its position in the world. (Sprite will need to set its z-position, see SpriteDepthInMap component)
  • Bug Fix: Tile Objects in Isometric maps have their position and collision geometry properly set now.

Version 1.0.5.1

  • Bug Fix: Recently added support for Object Types introduced a crashing bug when using unity:sortingOrder custom attribute.

Version 1.0.5.0

  • New Feature: Object Types now supported. Default property values for Objects will be exported to Unity.
  • New Feature: Multiple collider types on same Tile Layer. You no longer have to manage separate layers for specific collision types.

Version 1.0.4.7

  • Bug fix: No longer crashes if Tiled map file layers reference tiles that no longer exist.

Version 1.0.4.6

  • Bug fix: TMX files with extra periods in their file name can be successfully imported now.
  • Bug fix: Fixed shader issue with some Android hardware by simplifying and re-arranging shaders.

Version 1.0.4.5

  • New 64 bit version: Provides better stability with large maps that could run out of memory in the 32 bit version.
  • Bug fixes: Reduction in memory usage reduces risk of running out of memory while opening or exporting TMX files.
  • Improved previewer: Rendering map previews is 2-3 times faster now.
  • Improved reporting: Users trying to import while using the Unity Web Player should have a clearer message now.

Version 1.0.4.4

  • Unity 4.x Support: By popular demand Tiled2Unity will work with Unity 4.x installs.
  • Bug fix: Unity scripts no longer throw exception when trying to re-import a Tiled2Unity folder

Version 1.0.4.3

  • New Installer: The NSIS-based installer was being falsely flagged as malicious by some anti-virus software. Now using an MSI installer package.
  • Improved reporting: Will now be warned if you try to export a Tiled map that has a PolygonCollider2D that is “too complicated”. (This usually means you set up colliders in Tiled without using “Snap to (Fine) Grid”.
  • Bug fix: Removed GDI+ library dependency that was crashing some Mac users in Tiled2UnityLite.
  • Bug fix: Fixed crash with Tiled maps that contain only Image Layers.

Version 1.0.4.2

  • Bug fix: Fixed unity:convex not being interpreted as a boolean.

Version 1.0.4.0

  • New Feature: Now supports rotated Tile Collision Editor colliders from Tiled.
  • Bug fix: No longer crashes if Tiled2Unity cannot find installed Tiled2Unity.unitypackage file.

Version 1.0.3.0

  • New Feature: Can now choose to export polygon collisions as a series of convex polygons instead of one “complex” polygon that may have holes and convex edges.
  • Bug fix: Fixed crashing bug when extra tile data remained in a TMX file for a tile that has been removed from a tileset.
  • Bug fix: Will no longer crash if unity:sortOrder property value is not an integer (reports an error instead).
  • Improved Feature: Tile Objects can set their own sort layer name and sort order.

Version 1.0.2.4

  • Bug fix: Fixed exporter crash when tileset image file cannot be found.
  • Bug fix: Fixed exporter crash when old tile data remains in TMX file from a tile that has been removed.
  • Bug fix: Fixed exporter crash after removing tile from “Collection of Images” tileset.

Version 1.0.2.3

  • Bug fix: Reverted normal on map meshes back to (0, 0, -1) as positive-z goes “into” the screen.

Version 1.0.2.2

  • Bug fix: Generated meshes are using the proper normal vector for lighting. (This was a mistake. Reverted in 1.0.2.3)
  • Improvement: Tiled2Unity can be used in WebPlayer builds again. However, you must import your Tiled maps using another build target first (Standalone Windows/Mac/Linux will do).

Version 1.0.2.1

  • Bug fix: Fixed compile error with Unity 5.0
  • Bug fix: Fixed string exception being thrown when (re)importing Tiled2Unity.xml.txt marker file.

Version 1.0.2.0

  • New Feature: Added support for unity:resourcePath custom property on Tiled maps. This instructs Tiled2Unity to build the map prefab at Tiled2Unity/Prefabs/YourExtraPathHere/map.prefab

Version 1.0.1.2

  • Bug Fix: Fixed bug with importer getting stuck when saving a prefab to the Resources folder.

Version 1.0.1.1

  • Bug Fix: Replace compile error CS0234 with notification that Unity Web Player is no longer supported.

Version 1.0.1.0

  • Bug Fix: Fixed compile error when importing with earlier versions of Unity 5.x (5.0, 5.1, and 5.2)

Version 1.0.0.2

  • Big Fix: Fixed compile error when building the Unity player.

Version 1.0.0.1

  • Bug Fix: Textures used only for Tile Objects were not being exported to Unity
  • Bug Fix: Tile Objects were not placed correctly when used with vertex scaling

Version 1.0.0.0

  • Optimized: Animated tiles no longer manipulate vertex data. This is a significant optimization. Additionally, tile animations no longer cause garbage collection spikes.
  • Optimized: Importing *.tiled2unity.xml files is now significantly faster, especially for larger maps.
  • Bug Fix: Colliders on Tile Objects now alligned properly with the origin of the Object.
  • New Feature: Tile Objects now supported visually.
  • Deprecated: Unity 4.x versions no longer supported.

Version 0.9.13.1

  • Bug Fix: Tiles that were rotated and/or flipped could introduce seams depending on camera settings.

Version 0.9.13.0

  • New Feature: Tileset Offset property is considered in placing tiles (Note: This could lead to overlapping tiles that don’t sort as you may expect. Prefer to use Layer Offset instead.)
  • Modified Feature: unity:ignore custom property can be assigned to false, true (ignores whole layer), collision (ignores collision on layer but exports visuals), and visual (ignores visual tiles on layer, exports collision only).
  • Bug Fix: Image Layers with no image no longer crash Tiled2Unity
  • Bug Fix: Fixed compile issue with older versions of Unity

Version 0.9.12.0

  • New Feature: Tiled Image Layers are now supported.
  • New Feature: Layer Opacity is now supported.
  • New Feature: Layer Horizontal and Vertical Offset is now supported. (Currently only in the Tiled daily build. Will automatically work in Tiled2Unity when feature goes live.)

Version 0.9.11.2

  • Bug Fix: Command line argument that selected your Tiled2Unity export folder has been fixed (broken by 0.9.11.0).

Version 0.9.11.1

  • Bug Fix: Scripts updated for Unity 5.1 (previous versions of Unity 5 and Unity 4.x are back supported).

Version 0.9.11.0

  • New Feature: Tiled2Unity now works at any location in your Unity project. It no longer has a hard-coded dependency on being located at Your/Unity/Project/Assets/Tiled2Unity.
  • New Feature: Add the unity:resource property to your collection of Map properties in Tiled so that the prefab is saved to the .../Tiled2Unity/Prefabs/Resources directory. This allows you to instantiate the prefab via script in your Unity game.
  • Potential Bug Fixes: All DLLImport unmanaged code has been removed from the Tiled2Unity utility. This should make life easier on anyone porting Tiled2Unity to a non-Windows platform.

 Version 0.9.10.0

  • New Feature: Isometric and Hexagonal maps now supported.
  • Bug Fix: Using NonZero polygon fill rules when combining collision geometry now so that overlapping polygons don’t create holes.

Version 0.9.9.4

  • Bug Fix: Some animated tiles were still broken when using vertex scaling.

Version 0.9.9.3

  • Bug Fix: Animated tiles are working again in maps that use vertex scaling.

Version 0.9.9.2

  • Bug Fix: Fixed script compile errors while using Unity 4.x.

Version 0.9.9.1

  • New Feature: Updated to work with Unity 5 without any modifications.
  • New Feature: Added Preview Options to previewer. Improved the look of collision geometry in the previewer.

Version 0.9.9.0

  • New feature: Object rotation now supported.
  • New feature: New unity:collisionOnly property on Tiled layers will export only the collision data from the given. Meshes will not be generated.
  • Improvement: Previewer no longer contains seams when using zoom.
  • Improvement: UI added for modifying vertex scale. No longer have to rely on –s or -–scale command line arguments alone.
  • Bug fix: Tiled2Unity would crash if you entered a value for a boolean property which didn’t resolve to true or false.

Version 0.9.8.0

  • New feature: Vertex scaling through command-line argument (-s or -–scale). The vertices of the exported maps and collision maps will be multiplied by this value. For some users this will be a better way to control the size of map instead of scaling the whole prefab.
  • New feature: Texel bias setting exposed through command line-argument (-t or -–texel-bias). This helps when using some shaders that under certain conditions give the appearance of seams in the tiled map.

Version 0.9.7.4

  • Bug fix: Exporting would crash if you had a Tile Object in an Object Layer that had no custom properties.

Version 0.9.7.3

  • Bug fix: Gizmo selection of TiledMap prefab takes scale into consideration.
  • Bug fix: TMX files with extra period characters in the file name are supported.
  • Bug fix: Texture files referenced by Tiled maps with extra period characters in the file name are supported.

Version 0.9.7.2

  • Bug fix: Gizmo selection of TiledMap prefab now takes world position of game object into account.

Version 0.9.7.1

  • New feature: Preview in Tiled2Unity exporter supports 1/8th to 800% zoom. Allows preview of maps that were once too large to preview.
  • New feature: New unity:ignore property allows you to have layers in Tiled that are ignored by the exporter.
  • New feature: New TiledMap component is added to imported map prefabs automatically, containing dimensions of map.

Version 0.9.6.1

  • Bug fix: SortingLayerExposedEditor class no longer collides with Editor namespace.
  • Bug fix: Changes made to texture importers by hand are not overwritten on subsequent exports to Unity.

Version 0.9.6.0

  • New feature: unity:isTrigger support added.
  • Bug fix: Fixed bug with rotated tile collision geometry in cases where collision data had a non-zero position relative to the tile.

Version 0.9.5.4

  • Bug fix: Animated tiles were not working if Unity split the mesh into smaller sub-meshes
  • Bug fix: On some graphics hardware and resolutions, dark edges were appearing on the upper and left side of tile boundaries

Version 0.9.5.3

  • New feature: Render order of tiles supported
  • New feature: Animated tiles supported through Tiled Animation Editor

Version 0.9.4.6

  • Bug fix: Margin settings for textures follow same rules as Tiled.

Version 0.9.4.5

  • Bug fix: Rotated tiles often had incorrect texture coordinates in generated mesh.

Version 0.9.4.4

  • Bug fix: Added a bias to generated texture coordinates. This should resolve issues with seams that some users were seeing.

Version 0.9.4.3

  • Bug fix: Unity was renaming our generated meshes under some conditions.

Version 0.9.4.2

  • Fixed bug where textures with whitespace in their name we’re not being assigned to their matching material and meshes during import.
  • Exported *.tiled2unity.xml files are always re-imported now when exported, even if the data hasn’t changed.

Version 0.9.4.1

  • Fixes texture coordinate bug with some flipped or rotated tiles.

Version 0.9.4.0

  • Tiles (including collisions) that are flipped or rotated in Tiled Map Editor are now supported.
  • Tiled maps with flipped or rotated tiles no longer crash Tiled2Unity.
  • Several speed improvements. Useful for viewing and exporting “large” Tiled maps.

Version 0.9.3.0

  • Polylines added to tiles in the Tile Collision Editor (in Tiled) are exported as EdgeCollider2D objects.

{ 3 comments… read them below or add one }

noname December 18, 2016 at 4:35 am

i have a question …… is it only possible to import the maps to unity only or can you import them to other game makers such as rpg maker??

Corrine January 5, 2017 at 7:25 pm

whoah this weblog is wonderful i love studying your articles.
Keep up the great work! You understand, a lot of individuals are
looking round for this information, you can help them
greatly.

April January 7, 2017 at 12:13 pm

Sοme genuinely excellent content on this internet site, ɑppreciate it for contribution. “Such evil deeds could religion prompt.” by Lucretius.

Leave a Comment

{ 3 trackbacks }