How Object IDs are generated

(Ron) #1

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.

(Thorbjørn Lindeijer) #2

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

(Ron) #3

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