Loading Character Object from my save game returns null when passing to another level

Hello guys,

I’m quite new at using blueprint and I struggle on an issue for many hours now…
I have a Hero class, child of Character class, that has many variables.

In a first level I ask the player to initiate the Hero stats (like intell, strengh etc…) and put all the choices in my hero_instance variables.

Still in this level I save the hero instance in a file, (tested and works perfectly) and open a second level (the world the hero will evolve).

The problem is

when I load the savegame file and try to access to the variables of the saved hero instance, it returns null, but if I try to get another standalone variabl, like an integer, in my saved file it works perflectly…
When I load the save game file in the first level, and try to access to the saved hero instance variables, it works well also.
I had the same problem using a personalized game instance, that s why i wanted to used a save file…

I can’t understand how to brings all my hero data in another level (also : i need to do the same for lots of IA characters that I set in the first level and need to bring in the other level)

Does someone have any clue on how I can manage it ?

Thank you very much for your help

Bests

By instance do you mean character reference?i don’t know but usually I just put some variables in the save game like heath ,damage,move speed ,etc.and spawn a new character to another level and initial character with the variables stored in the save game.

Thanks for your quick answer.
Yes i did like you at first and it worked, but then increased a lot the numbers of variables of my world, and needed to optimize the storage of the data of all my characters

To answer you : yes it is an object reference

snappb

1 Like

If you mean optimize the number of variables I suggest create some struct.it helps organize variables together.if it’s performance reason I think a character reference could probably be worse ,because it not only has variables but also has meshes and components(increased storage).

References shouldn’t be saved. It’s just a pointer to the memory address of the object.