Game Development Reference
In-Depth Information
public void SetSettings(string Name)
{
switch(Name)
{
case "Low":
QualitySettings.SetQualityLevel(0);
break;
case "Medium":
QualitySettings.SetQualityLevel(1);
break;
case "High":
QualitySettings.SetQualityLevel(2);
break;
}
}
For this function, we run a switch statement on the string that we passed to determ-
ine the quality setting. To set the quality setting, we access the SetQualityLevel
function of QualitySettings and set it to the associating quality level.
Loading the settings
The final function that we will add will allow us to load all of the settings that we saved
and set them in our game; this function will be used the most. Add this function to
the bottom of the script:
public void LoadAll()
{
SetSettings(PlayerPrefs.GetString("Custom_Settings"));
ToggleShadows(PlayerPrefs.GetInt("Custom_Shadows"));
SetFOV(PlayerPrefs.GetFloat("Custom_FOV"));
SetResolution(PlayerPrefs.GetInt("Custom_Resolution"),
PlayerPrefs.GetInt("Custom_Full"));
Search WWH ::




Custom Search