So I recently made a master volume slider, and it’s working all nice and dandy. The only problem is when I exit the settings screen and go back to it, the slider is back at 100%. Now the music stays at the volume which I set it to, which is good. I just want to know how to keep the slider position to stay where I left it.
Hi,
You can store the value somewhere.
Then when you are showing the widget containing the slider, you can use the Set Value from Event Contstruct.
Getting the value from where you stored it.
Do you want to save it so that it persists even after you reopen your game or in the current session only?. Also to get the slider value, go to your widget bp designer and select the slider you want to get the value of, in the details section on the top you will see a checkbox for Is variable or something similar. click on that. now in the widget bp area. in the variables section you will see that the a variable with the slider’s name will appear. you can use that variable to get the value of the slider.
When you have set the value to another variable which lies in something like the player character you can use the set value node and use the slider variable as target. Basically what METAL GEAR GAMES has shown. this needs to be done in the widget bp which has the slider.
In this SaveGame Object you can add a variable (float) where you can store the slider value.
When you open the widget containing the slider, you want to load this variable and set the slider’s current value to it using the “Set Value” node. You must make sure that the slider has “Is Variable” checked, as SupDeity pointed out.
When you change the slider’s value, save the new value to the SaveGame Object.
It’s a variable you create yourself, you can see it on the left hand side in the variable list. Create a new variable, select it and set its type to Your_Save Game - Object Reference in the Details panel.
edit: I’ll just add that you need to create a save game object first.