Download

Impossible to load Player Character Blueprint from SaveGame object

Hello everyone, I encountered several problems using SaveGame objects. In my SaveGame, I’ve got a variable called “MainCharacter” which is a MainCharacter object (I need to know what were the players health, armor, ammo and so on) ; so when it’s time to save I use the Save Game To Slot node in a blueprint to save the result ; the function returns “true” meaning everything is right.
However, when I load my save game using Load Game From Slot in a blueprint and I use Print String node to print my MainCharacter , it show “None”.
A long time after trying everything I can, I created a IMainCharacter interface (it has no functions) and implemented it in my MainCharacter blueprint. Now the load works (I don’t know why it needs an interface, it is even not specified in the actual documentation, so it really annoying me that a simple thing is not mentionned), but only if I launch the game from the CURRENT session editor.
So, if in the current session, I launch the game, play it, and save the MainCharacter blueprint then stop the game and relaunch it, the print node will work and print my MainCharacter object name.
However, if I close the editor and restart a new session and do the same thing, the print node prints “None”, meaning it has no loaded my character. However, if I erase the interface then implement it again, the load game actually reworks. So I thing it’s definitively a bug from the editor and not me :-/ I tried everything I can and I can’t find a solution to my problem. Please help !

Have you tried saving your variables and not the reference to the character itself? And then have an event that loads those variables to the character as opposed to loading a reference to a character?
I dont fully understand why you need to save a reference to your character when all you really want are the different values.

No, I didn’t try to save only all the variables, but if it still doesn’t work, I will try. I want to save only my character because the blueprint has a lot of variables, so I thought it was better to save only my character to not put plenty of variables inside my SaveGame blueprint. One thing I don’t understand is that I save several objects to a slot (pickupble and ennemies) and it’s working fine. I don’t know why it’s not working on my character.

Hi.

Saving your character does not save the variables of the character. All it does is save an object reference to your character. Your HP, damage, hunger or what ever values you have will not be saved.
Its is literally just going to save an object that is your character. Not the variables inside of it.

Yeah, I just figured that, glad you confirm that too. But it isn’t precised in the documentation. I think Epic should update it.