- Home /
Quality settings reset after scene loads
Hello! I have a settings menu with an option of changing graphics. When a player dies, the scene reloads. My problem is if the player switches graphics in the settings then dies, the graphics default to normal and not what the player wanted them to be at. How would I fix this? Thanks.
Answer by alelavoie · Jan 17, 2018 at 03:27 AM
You could use PlayerPrefs to store the player's preferences and access them every time the scene is loaded to apply the proper graphics. Bonus: It would also remember the preferences between game sessions (after exit/restart).
Here is how you set PlayerPrefs
PlayerPrefs.SetInt("GraphicQuality", 10);
PlayerPrefs.SetString("Resolution", "3840x2160");
And here is how you access them
int GraphicQuality = PlayerPrefs.GetInt("GraphicQuality");
string Resolution = PlayerPrefs.GetString("Resolution");
So, here is how you could do it:
When loading the scene, a script should try to read the PlayerPrefs and apply the custom settings.
If no PlayerPrefs for a specific graphic setting is defined, use the default.
When the user edits a graphic setting, save the new value as a PlayerPref
Hope this helps.
Can this functuin happens on QualitySettings.SetQualityLevel(int)? (İ cant do playerprefs:))
Answer by Carson365 · Jan 17, 2018 at 03:28 AM
I'm pretty new to player prefs, so how would I go about that? Thanks.