I am looking to serialize all Actors in a particular level, to be saved out and restored later. This is fine, except I need a key for each Actor to use. I have been looking at GetObjectName() and GetUniqueID(), however I don’t think either of these ID types fulfill the following requirements:
ID is unique for each Actor in the level
ID does not change between level loads
What identifier would you use? Do I need to add a UUID property to differ all instances of my Actors?
Returns the unique ID of the
object…these are reused so it is
only unique while the object is alive.
Useful as a tag.
So I think they will be unique between level loads, only if objects are alive.
I was using hashed GetObjectName() to identify objects on my level. And I think both functions fulfill the first requirement.
But if you need UniqueID between levels, or even different instances of the game (from save files ex.) you should use your own actor field. If you have no option to make your own field, than I think GetObjectName() is dependent on actors class name and sequence of object creation. So reloading the same static level twice will produce same object names.