Using Tiled Custom Properties with SuperTiled2Unity


I have a orthogonal Tiled map (32x32 pixel sized tiles, 315x449 tiles, several embedded tilesets).
I successfully imported the Tilemap into Unity with SuperTiled2Unity and I can display the map ingame and move with my player character on the map (it’s a simple 2D RPG game).
Now I want to access my custom properties in my unity code.

First try: I gave some of the tiles a custom property in the tiles-editor of Tiled and did a refresh in unity. Was hoping, that I would see my custom properties in one of the SuperCustomProperties Monobehaviour components. But there weren’t any. The size value of the custom properties was still 0.

Second try: Using the “Objects Types Editor” of Tiled, I defined a simple set of properties, applied it to one of my tilesets and enter some values in the tiles custom properties (the ones that came from my custom object type), exported the object types xml, imported it into the preferences of unity and was eagerly looking for my custom types in Unity. But no joy so far.

I’m probably missing something basic here. Do I need to define a custom importer or something alike in advance?

Would be happy if someone could point me into the right direction.


Tiled: 1.3.5
Unity: 2019.3.7f1 Personal
SuperTiled2Unity: 1.91

1 Like

Ok, maybe I didn’t find the right words or didn’t describe exact enough what my actual problem is.
I’ll try to spice it up with some images:

My Tiled-map/TileSet:

  • I have setup a type in the Object Types Editor with two properties in it.
  • I see these properties in my Tileset and can fill them with individual values

In the Unity Project-Settings

If I check my tilesets in my Unity project itself, I still see a “0” for the size of my Custom Properties (I was expecting 2 for the friction- and sight-properties)

My problem is this last step on how to access these custom properties in Unity.


Oh, I see what’s happening, you’re looking at the custom properties for the tile layer, not the ones on the tiles themselves.

To retrieve the properties of a tile, you have to query the Tilemap for the SuperTile given the tilemap coordinates, using tilemap.GetTile<SuperTile>(vector3Int); (unity docs here)

SuperTile instances are not directly accessible through the Unity editor/property inspector, so they can be a bit tricky to work with.

The namespaces you typically need though are:

using UnityEngine.Tilemaps;
using SuperTiled2Unity;

Another trick that might be easier (and isn’t a big memory/performance hit if there’s a small number of these special tiles) is using an Object layer instead of a Tile layer.

You can drop tiles into an object layer with “Insert Tile” (T), snapping to your grid with View > Snapping > Snap to Grid.

Oh boy, I got it! Thanks for pointing me into the right direction Peter…

Anf that’s my (simple proof-of-concept code)


1 Like