Unique ID for actor instances for saving

Thought I’d ask here as I need help asap, I’m looking to generate unique ID’s for each instance of actors so I am able to save picked up objects. It is going to be used to save what items have been picked up, so I can save/load them, so it cannot EVER change, not when compiled, not when the project is closed, not when the game is packaged, never.

Here’s a quick list of what I’ve tried

“get display name”, used for ages and seemed fine, but doesn’t work for shipping builds, even says so the description
“get object name”, doesn’t work with streaming levels, repeats names
“get actor GUID”, editor only
“new GUID”, first seemed to work and not change if I set it in the construction script, and then set a string to the GUID, make the string instance editable, and only get a new GUID if the string is empty

The “new GUID” system would work well, but when you close/open your project all the GUID’s reset, and I’ve kind of hit a wall here lol

(this is the construction script setup if it helps)

you dont need the string at all, save the GUID, when the construction script runs check if the guid is valid, if so do nothing

However, if possible, it is better to avoid using GUIDs in favor of saving and loading object references. Standard serialization allows for the correct reconstruction of all dependencies between objects.

Yeah makes sense lol, I just want to save multiple separate actors using the same array.
I think I’ll be able to make a workaround if I get a unique identifier for each object per-steaming level and then just add the name of the currently streamed level (already saved in the player) onto that, so I just want to make sure, if I use “get object name” will the order of which the objects are named always be consistent (including in the shipping package)? If not is there some other way of doing it that will do so.

You specifically need the object PATH.
The name is merely the final part of the path, and they may coincide. The path is unique to each object.
The actor’s path also includes the name of the level to which it belongs.

And that is exactly what is inside an object reference.

Thanks, very helpful, is there any documentation for how it works when packaged for shipping? more specifically if C:\Users\(name) will be included in the path or not.

(and yes I’m aware of the object reference, and it would be better, it’s just much more convenient for my purposes to make it non-actor specific, unless there is a way to make it not, not too familiar with how it works.)

No, the path looks like this:

/Game/MapsFolder/LevelName.LevelName:PersistentLevel.Actor_0

Game - this is your project’s content folder.

Upon loading, you can (and should) restore the object paths. Then, all references will automatically be correct.

It is important, however, not to change the load sequence: spawning objects → replacing their paths with the saved ones → loading references.