Game Development Reference
In-Depth Information
PlayerPrefs.SetInt("Custom_Full",
Convert.ToInt32(fullscreen));
if(aa)
PlayerPrefs.SetInt("Custom_AA", 1);
else
PlayerPrefs.SetInt("Custom_AA", 0);
if(sync)
PlayerPrefs.SetInt("Custom_Sync", 1);
else
PlayerPrefs.SetInt("Custom_Sync", 0);
PlayerPrefs.SetFloat("atmVolume", volBG);
PlayerPrefs.SetFloat("sfxVolume", volSFX);
PlayerPrefs.SetFloat("bgVolume", volATM);
PlayerPrefs.SetString("audioType", audiotype);
}
What this function will do is use the PlayerPrefs function to save all of our values.
To save the settings, we use the placeholder variables that we created earlier.
Loading all the values
The last feature of the Config_GUI script will be to load all of our saved data. Add
this last function to your script:
void LoadAll()
{
volBG = PlayerPrefs.GetFloat("bgVolume");
volSFX = PlayerPrefs.GetFloat("sfxVolume");
volATM = PlayerPrefs.GetFloat("atmVolume");
fov = PlayerPrefs.GetFloat("Custom_FOV");
aa =
Convert.ToBoolean(PlayerPrefs.GetInt("Custom_AA"));
shadows =
Convert.ToBoolean(PlayerPrefs.GetInt("Custom_Shadows"));
Search WWH ::




Custom Search