So this feels like a stupid question, but what is the correct way to create a Options/Settings menu in Godot? I am not asking about how to setup the UI, but how to actually make it work. I have managed to make my own system after watching a tutorial on custom resources that saves a .tres file in user:// and then updates the game’s settings when the game starts, but it seems like the incorrect way to do things.
Why? Well, my game starts in windowed mode by default and then switches to exclusive fullscreen, when every other game I have played starts up with the settings I saved! Godot has the ProjectSettings class which seems like the right answer, but I can’t seem to get it to work correctly. I’ve got another topic on that, but I created this one because it seems like a different discussion.
So do I use ProjectSettings and I am just using it wrong somehow, or is there some other way where the user’s saved settings are initialized as the game starts, not after it’s already loaded the defaults?
I’ve learnt how to do this, and I’ve been suggested by the community to help out others to learn Godot more, so here’s how I do it:
Make a separate scene for the Options/Settings menu
Make a button with a signal in your main menu scene that will open this menu, Here’s the code to use:
get_tree().change_scene_to_file(replace this with the options menu scene directory)
Connect the signal from the button and the code in Number 2 to it
If you want to go back to the original main menu, just do the same thing you did but instead you change the options menu to the start menu scene using the code
And that’s it, Hope this helps , And if it doesn’t, let me know (I’m not that good with Godot so this probably the most simple method)
Thanks for the reply @zdrmlpzdrmlp, but my current system uses what is essentially a config file. I also don’t want to use a plugin, I’d like to learn the built-in “correct” methods for Godot. Unless the intention of the engine is to just make something from scratch or use plugins, the ProjectSettings class seems to be what I want, but I don’t know if I am using it correctly.
Thank you as well, @ZV1LLE. Though I am not trying to change scenes. I have a “working” settings menu, I am just not happy with how it functions.
@TwinTailDigital Oh it’s fine, I thought you were trying to make one but didn’t realize that you were just trying a different to do so. I’m not quite familiar with the Project settings class or anything else you’ve mentioned so this is probably the best I can do for now, Wish you luck though
well the plugin is to save your headache to actually code your own save and load system that actually can save and load with no problem. you can even copy what the code does and integrate your own kind of save system. the plugin is like the basis. i even made it can have profiles in it using the plugin SaveSystem.gd code
yeah no one uses this project settings to set up their game on run-time. because once build it’s set to stone. until you actually restart your game after you do set_setting. your only options to load what the users data is to actually save and load it from user data, either by using your own save system or use plugin or use the config file to load if the game was last set to fullscreen or not.
it basically quickly load the player settings once the game started to determine if it should be fullscreen or windowed or maximized
I know people normally use plugins and templates to save the headache, but I am looking to learn how to use the engine myself. I do appreciate the link, and it might be a good idea for me to maybe learn from how they made the plugin.
My current system quickly loads the player settings once the game has started. I don’t like it this way, it would be nice if the player’s settings were loaded differently. Unfortunate that it doesn’t seem to be possible. Thanks for the help @zdrmlpzdrmlp
EDIT: ProjectSettings does actually work. I had a bug that I fixed and is now working without having to quickly change settings at runtime. A settings menu without needing a custom settings system, just using ProjectSettings