Does Tiled preserve attributes that are added extraneously to the file?

I am adding some extra attributes to my maps’ xml files. But it seems like they are being blown away when I open the map in Tiled and then re-save. Is that true? Is there any way to make it keep those around?

You can use custom properties in Tiled to add custom attributes to layers and objects in maps, and to tiles in tilesets. These will be saved and read in properly. If you add them in by hand to the file, they should also be read in correctly, as long as the format’s right.

1 Like

I’m using another program I wrote to add them. Is there someplace the required format is described?

Objects, Layers, Tilesets, and Tiles within a tileset can all have custom properties, and the format’s the same for all of them.
You can also add custom properties within Tiled itself, and you can automatically assign properties to various object types in the Object Type Editor. I recommend adding some properties via Tiled and seeing how they look in the resulting TMX file to get a feel for what your external tool needs to generate.

If you’re looking to add custom properties to individual tiles within a map, that’s not something you can do, but there may be other/better ways around that, depending on what you need to achieve.

1 Like

OK thanks that’s good news. I don’t need tiles with attributes, just objects…