I have set up a basic menu to understand the workflow of UMG, however I have a problem- when I go to the options widget inside the menu and change the values (sensitivity or high quality textures for example) and then press back to go to the main menu again, when I go into the options widget once more, the values have reset. Is there any way to go back to the main menu page while retaining the settings used if a player was to click into the options a second time?
I’ve looked into this myself and imagine you’ll need to actually save these values to an array of some kind.
Then you’ll be saving that array to a save file, as well populating your settings-menu choices from that same file each time you run (not to mention looking for available video modes to populate your choices for that particular option).
You’ll also need to check if that save file exists when you run, and if not, to create it.
But there is a way to do what you ask, but you really want to save settings info using the ideas I suggest above otherwise your settings won’t save between sessions.
If you still wish to just have your UMG menu retain it’s values (which is useful in other circumstances) without the bother of a save file or worry about saving between sessions… just load (create) it in the previous menu widget and then ‘add to viewport’ and ‘remove from parent’ as needed. Also make sure you are not removing the previous widget when you go to your settings widget.
This sounds like a much better approach, I might even look into having 2 or 3 template saves that would automatically set values, and then a user save which would be whatever the last settings the user had (if any). Thanks for clearing that up- it seems like creating the widget over and over would just overwrite the previous data. Would you have any idea how to implement these saves, or is it as simple as adding each input to an array when chosen, and setting the values in that array as default?
Also, I have another section of the menu that tweaks the colours on a mesh which is visible in the menu screen, and when I back out of the menus and go back into the colour customisation screen, the values don’t reset there- not sure why that is, but when I then open the game level, those colour values have reset to their defaults- may be due to not saving them, or may be the level itself initialising them, but I think the array save file method could work great here also!
I’ve at least read about arrays and save files but haven’t actually tried executing anything yet I’m afraid. I did think about it a bit though.
I was going to create a save when first-run and fill it with 7 values including the initial default res, mouse sens, volume, etc (all kept in an array). I was then going to have the settings menu ‘always’ be set via the array derived from the save file.
I would have the save file load on start and populate the settings menu… and when you leave the settings menu… then have them all save at once back to the array and to the save file (as opposed to saving each time a specific setting is changed). I’d also check if your vid mode is valid on every single run… never know when someone will swap stuff out on ya.
Your 2nd question, I’m thinking, deals with ‘casting’… something I have no experience in atm.
Wish I could help more but your new questions head into uncharted territory for me. /sorry
Also wanted to link were I started figuring this stuff out…
Saving Your Game with Blueprints
Thanks for the reply, I’ll have a look into making a similar system! Things get tricky when you have replication in mind for everything also, I might just try to get it to work offline first!
No problem- will try to get the casting thing to work with more experiments!