I have in my map an object layer called “playerstarts”. Each playerstart has a custom value called “team” which can be 1(red) or 2(blue). Every object is the same color however. It would be great for any with team 1 to be red in color, etc.
Currently I can make new layers to make things have different colors but it would really be great if each object could have its own color assigned to it. This would make managing my objects much easier.
Thanks bjorn, that helps for now, my map looks better already
Per-object color override would be awesome since…
A) custom colors per object would be saved in each individual map.
B) Over time preferences>object types would eventually become a large unmanageable mess
Right, I didn’t save the colors in the map because that way you’d have to set up the colors manually all the time, whereas having them in the preferences you set it up only once and you can even change your mind about the colors easily later. There’s the option to export the color definitions to XML to share it with others.
My assumption here is that you will actually have only a limited amount of different object types of course. I think of types like “exit”, “spawn area”, “teleporter”, “npc”, “checkpoint”, etc. Even in your example you only mentioned two colors.
So while I don’t think individual colors would be a bad feature, I haven’t rushed to add it because I thought the other coloring mechanisms were more appropriate in most cases.
Hi again Bjorn
So it would really be good if you could have object type colors saved in a map file. I find when I export (to lua) that object types are not exported. so I have to have separate tables with corresponding colors in my source code.
Also, when I give maps to other team members… if their Tiled is not configured exactly as mine… the object colors we have decided on are not present.
So I personally think it would be great to be able to save those somehow in the map and have them exported as well
The main thing that should help right now is to change the location of your objecttypes.xml file to be inside of your repository, so that all your team members can choose to use that one and you guys will stay in sync. You can do this via the “File” menu in the object types editor.
Regarding this, in general, I think it should be solved by introducing a “project” file that covers all such relevant configuration. It would give a clear separation between settings that are user-specific and those that are project-specific like the object types.
I’d rather not solve the issue by moving all “project” settings into the map file.
So, you can already save that file in a different place and switch between files when you switch projects. It’s just not as convenient as it could be. Like I said before, I think having a Tiled project file would resolve this. Since recently the idea has a proper issue on GitHub:
Just want to chime in here, I came across an instance where per-object colors would be preferred over object types - basically I have some objects that to the game engine are all one Type, but I want them to have unique colors each. Currently working around this by telling my engine to ignore the “Type” value of this layer so that I can make each object a separate color.
This thread is two years old so I don’t know whether this issue was addressed after it was posted or whether this is an old feature, but you can assign custom Color properties to objects.
TBH I always figured the object type colours were more for differentiating different types of objects in the editor, so when it came to assigning them colours, I always did so with custom properties, which can have a default assigned for each type in the Object Types Editor while also being easily overridable :'D
Maybe I should clarify- I’m trying to change the color of rectangle objects in the editor so I can tell them apart visually, not add a color property to the rectabgle.
No worries, it was clear from your post, which is why I mentioned that the custom colour doesn’t display in Tiled.
If you need to tell them apart visually while editing your level (as opposed to in-engine, where you can do it via the custom property), then it sounds like they should be different object types, even if they have otherwise similar/identical properties. As I mentioned, the object colours in Tiled seem to me to be primarily meant for ease of visual identification during editing, not for in-game purposes.
Unfortunately it is the case that you can only set the color for an objects type and you are not able to set the color of individual objects.
More inflexible is that you cannot embed this information inside a tiled map on a per map basis and your object types list starts to get very bloated after a few projects, and you cannot delete the ones not applicable to a current project… because opening a file from a previous project will cause all colors to be incorrect.
Thanks @AxiomVerge and @Rabbit for the additional feedback. I definitely think it makes sense to support per-object colors in Tiled, since indeed per-type or per-object-layer (which is also an option) is not always what people are looking for. It’s a feature that should be quite easy to add, so I will try to get around to that soon.
As for storing the object types in a map file, this has other disadvantages so what I’m really looking to do is to associate this stuff with a project file, as I mentioned in my previous comment. Due to other priorities this will take a bit longer to get around to, but I do plan to work on that within a few months.