how to access playerprefs unity code example

Example 1: how to use playerprefs in unity

SAVING
 
 PlayerPrefs.SetInt("score",5);
 PlayerPrefs.SetFloat("volume",0.6f);
 PlayerPrefs.SetString("username","John Doe");
 PlayerPrefs.Save();
 
// If you need boolean value:

 bool val = true;
 PlayerPrefs.SetInt("PropName", val ? 1 : 0);
 PlayerPrefs.Save();

 READING

 int score = PlayerPrefs.GetInt("score");
 float volume = PlayerPrefs.GetFloat("volume");
 string player = PlayerPrefs.GetString("username");
 
 bool val = PlayerPrefs.GetInt("PropName") == 1 ? true : false;

Example 2: playerprefs stored at unity

windows+R >> regedit >> HKEY_CURRENT_USER\SOFTWARE\Unity\UnityEditor\CompanyName\ProjectName