How Object IDs are generated

When a new object is added, it seems the new ID is just the highest number ID + 1. Is this how it’s done? In my game, I need a way to uniquely identify objects that persist across runs of the game and it seems the best way is to use the object IDs. Before I do, I want to make sure that they won’t get renumber or start using gaps that might have resulted from deleting old objects.

Tiled does this by saving the next unused ID in the map file. See the nextobjectid attribute at

Doh! I looked all through the map file and must of missed it. I see it now.