Save Data Through Widget Blueprint?

I just recently setup a save game system with blueprints. At first I set it up in my third person character and binded it to keys for saving and loading. I want to change it over so they can save and load through the pause menu. I have my pause widget setup already. I basically just copied and pasted my BP setup from my third person character to my pause menu widget and made it so it saves and loads on the click of a button instead of keys. However it’s not saving nor loading. As you can see from the following screenshots, I have a print string in my save game setup at the end. It prints the string “SAVE COMPLETE” but, it doesn’t save any data. Any help would be greatly appreciated!

Save Game Setup:

Load Game Setup:

Error Log:

Move the actual saving and loading to another actor/object. Perhaps the gamemode or gameinstance? Have the button call the events to handle these saves, but don’t implement saving/loading in UMG.

The error indicates that the Char reference is null; you didn’t set it.

Either way I would recommend going a different route. Create another instance for your saving so that you can access it from multiple blueprints. This way you can eliminate rewriting code across several blueprints if you need to change something.

As others have said you should put the save in a different section and access that through UMG, but I’ll tell you off the bat that your method won’t work - you’re creating a new save game every time the save button is clicked and loading that. So you’ll never load any data.

You need to do Check if Save File Exists, if it does, Load from Save File, if not, Create Save File.

Thank you everyone that has replied to the post. From my understanding, I have done it right. However, it’s still not working. I put my save game and load game into functions in my third person character and called them in the widget blueprint. Is that how it is done? is my widget bp setup.

Thanks!

Anyone :)?

try to delete old save file

I would recommend to NOT make the savegame functions in your character. You will want your savegame mechanics to be available globally.

's a good tutorial in the documentation - start easy saving a single variable (Maybe health) and continue from that. Afterwards make a list of what variables you need to save and load. Basically you save just variables like “character position” “current health” and so on.

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html