I’m working on a system to persist objects like in Skyrim, such that anything the player leaves in a streamed sublevel will remain present if the player leaves, unloads that level, then re-enters it. I’ve gotten as far as building a set of functions that run when the level unloads and locate every object that needs to be persisted, but I’m really lost on what data format I should be storing them in. There’s not enough commonality between objects to make them all children of a common parent class, and lots of them hold information in specialized structs or other unique data formats, so it isn’t enough to determine which blueprint class each persistent item belongs to and create a new version of that blueprint when the level re-loads.
So is there a way to preserve an actor of unknown type along with its unique variable values without keeping it loaded in active memory? Or is this a case where I should try to refactor my entire system so that every persistable item shares some common data struct which is what gets saved when the item itself is unloaded?