Complete the code to save the player's score using PlayerPrefs.
PlayerPrefs.SetInt("PlayerScore", [1]);
We use playerScore as the variable holding the player's current score to save it.
Complete the code to load the player's score from PlayerPrefs.
int loadedScore = PlayerPrefs.[1]("PlayerScore", 0);
GetString instead of GetInt.SetInt which saves data instead of loading.We use GetInt to retrieve an integer value saved with PlayerPrefs.
Fix the error in the code to save the player's level progress.
PlayerPrefs.SetInt("PlayerLevel", [1]); PlayerPrefs.[2]();
Save() after setting values.The first blank should be the variable playerLevel to save the level number. The second blank should be Save to write changes.
Fill both blanks to check if a saved score exists and then load it.
if (PlayerPrefs.[1]("PlayerScore")) { int score = PlayerPrefs.[2]("PlayerScore"); }
SetInt instead of GetInt.Use HasKey to check if the key exists, then GetInt to load the score.
Fill all three blanks to save player's name, score, and then save changes.
PlayerPrefs.[1]("PlayerName", playerName); PlayerPrefs.[2]("PlayerScore", playerScore); PlayerPrefs.[3]();
SetString and SetInt.Save().Use SetString for the name, SetInt for the score, and Save to write changes.
