How do I set Custom Properties to a tile that transfers to objects?

Hi there!

I am currently using Tiled to make maps for my Unity game (using Tiled2Unity).
To be able to draw Prefabs in tiled, I use an Object Layer with e.g. the property: “unity:tag = spike_floor”.
I can get that information in Unity nicely, but…
This way, I have to have one Object Layer for each type of Prefab I want to draw. That will add up to a ton of Object Layers.
(When placing objects, I use the “Insert Tile” tool to be able to visualize the map, and use the corresponding tile from the tilesheet).

I have tried to add Custom Properties to the tiles themselves individually, but they are not being transferred when placing them in the Object Layer. Why is this not possible?
And is there a way I can easier draw my Prefab Objects (with unity:tag) without having eventually >50 different Object Layers?

I use Tiled2Unity for a lot of custom and complex tasks and I never have to cope with a large number of layers. Is there a reason you want to find out if a specific tile in your map is a “spike_floor” type? If it is do deal damage to a player who lands on spikes then it’s better to have the represented as a collider. In the Tiled Collision Editor you will add an object and give it a “type” that you define. All tiles of that type will then be combined into one large collider. Then in your Unity scripts you can test if your player has collided with the spike collider and go from there.

I talk a bit more about that on my blog here:

Thanks for your reply!
The spike was just an example. I also have moving objects, turrets, and other objects that are not only a colliders.
Properties on the colliders is a neat feature, indeed. Didn’t know about it before now. But I don’t think it will help me place objects with specific scripts attached to them.

This tutorial may help you then. In it, I use the automapping features of Tiled to automatically create other tiles or objects that can then be consumed in “some interesting way” by the game I am exporting them too.


Wow, that actually worked! Perfect, thanks a lot! :smiley:

I really appreciate you working on this project, because it is a real life saver for a lot of us :slight_smile: