void OnGUI()
{
GUI.Label(new Rect(0, 0, 100, 50), "Score " + score + volume + player);
if (GUI.Button(new Rect(10, 50, 200, 20), "Save"))
{
PlayerPrefs.SetInt("score", 50);
PlayerPrefs.SetFloat("volume", 0.9f);
PlayerPrefs.SetString("username", "kkas");
PlayerPrefs.Save();
}
if (GUI.Button(new Rect(10, 10, 200, 20), "Load"))
{
score = PlayerPrefs.GetInt("score");
volume = PlayerPrefs.GetFloat("volume");
player = PlayerPrefs.GetString("username");
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter