Hello! I have a save game object, named SG_Main. This is created at the start of the main menu. The save game slot is also called SG_Main. I only have 1 variable in the save game, which is called “RestartWithROn” Basically I want to be able to check a box in the settings and allow the player to choose whether to restart the level when they press “R” or not. Below is my code I have set up in the widget with the check box inside.
When I check or uncheck the box in my settings, the print string always says “Not saved” which means whenever I check the box it is not saving the value of the variable to the save game object. I can confirm it is broken as the code in my character blueprint does not allow me to restart with R even though the check box is on. Also, whenever I check the box in the settings menu, it always resets back to unchecked. It seems to me that this is a problem with the “load game from slot” node because the code after that never fires off.
Below is the code that I have set up to create the save game object with the save game slot.
Can anyone provide some insight as to why this isn’t working? This would be much appreciated as I plan to add more variables in this same fashion but need this to work first. Thanks in advance!
Also, the “unchecked” and “checked” print string in the first image do not work. I’m pretty sure the branch after the load game from slot does not work.
This does not work. I’m assuming I’m not doing it right? I set a variable of my save game object type after the cast. Still does the same thing, but with this error.
In the code we have seen there is no Create Save Game Object to get an initial one saved (so there is something to load). You mention this is happening at ‘start of the main menu’, so might be a timing issue (this widget’s construct is coming before the Create Save Game Object and Save Game to Slot calls), insert some more print strings to determine that If not, might need to post that code too.
I handle this all together (load or create new) for ‘player profiles’ in my game, which appears to be an identical use case. I do so in my Game Instance class, as it will be used all over the place (and you can be fairly sure it is loaded before anything else):