user13598462
user13598462

Reputation:

Unity - How to make a settings menu?

I'm making a settings menu in my game, but I don't know how to make it. I tried a few tutorials, but when I finish them they don't work. So, in the main menu I made a button that goes to the options menu, and in the options menu, I made a button that goes to the settings. In the settings menu I want to make a dropdown that changes the resoluton, a dropdown that changes the quality and a toggle that enables/disables fullscreen. I researched a lot, but I couldn't found anything. The main problem is that if I change the settings, then I exit the settings, and then I go back to the settings, the settings don't save. If you know any way to make a script that controls the settings menu, please help!

Upvotes: 1

Views: 1195

Answers (1)

Ibrahim R Serpici
Ibrahim R Serpici

Reputation: 1076

You need a basic save system to keep your variables saved.

Most basic thing I could suggest is

Saving your variables like

PlayerPrefs.SetInt("screenwidth",800);
PlayerPrefs.SetInt("screenheight",600);
PlayerPrefs.Save()

And load them whenever they are necessary

int screenWidth = PlayerPrefs.GetInt("screenwidth");
int screenHeight = PlayerPrefs.GetInt("screenheight");

Upvotes: 1

Related Questions