Download

How do you do this? save in a savegame slot an array of references!

Im learning to use the UE4 savegame system, I had success saving/loading simple variables. Then I tried to save a whole blueprint instance, this blue print has only a static mesh component that is set to a specific mesh by the user at runtime. I made an array of this blueprints and tried to save the array, when loading this the array has as many elements as when it was saved… only they seem to be empty, I guess this is so because the original elements were stored as references and after loading a new map and they were lost (obviously), am I right?

If Im right then how this could be done? should i store the name of the mesh (set by the user not always is the same, and its transform could be adjusted by user too)?
I know storing the name of the mesh would work as it’s only a string but how you load an asset only with it’s name? (and I have dozens of them I just cannot make a switch kind of selector in blueprint).
I know assets have an id too, how can i get it? can it be put in a gamesave as a variable (I guess so)?

Thanks for any help!
n1: I did search before post but the only info I found was related to saving/storing simple variables
n2: all of this topic relates to runtime actions not editor ones (i know how to import and save assets there :slight_smile:
n3: i tried to do this with gameinstance too but the result was exactly the same

Hello, good luck finding a solution… i am stuck too when it come to save and restore objects/actors reference

Even plugins on the marketplace i tried cant save and restore references

If the save system works like I think it does then you are actually just saving the address in memory of that object and when you for example reload the game you are just loading in the address and not the actual object. A good way to do this would be to save important variables from that object so you can construct it later.

That’s right Blue man, I have that well understood (now :slight_smile: )
skeleton60 the solution I found was use the Asset Registry node, so you only store the names, material (name) and transform of your assets in the variable/array (indeed for now im only storing an array in game-instance, although of course you can have it in a save game, indeed im going to have it to in the end) and using this they can be “re-found” inthe registry, I think is a good idea store the output array in a variable and load it just once (I keep it in game instance)

Here’s a screenshot how I did (in the output array elements (assets) you will have many properties, one of them is the name of the asset), you can do this too for Class Name: Material
Captura.JPG