Recall & Review
beginner
What is PlayerPrefs in Unity?
PlayerPrefs is a simple way to save and load small pieces of data like settings or scores between game sessions.
Click to reveal answer
beginner
How do you save an integer value using PlayerPrefs?
Use PlayerPrefs.SetInt("key", value) to save an integer under a specific key.
Click to reveal answer
beginner
How do you retrieve a saved float value from PlayerPrefs?
Use PlayerPrefs.GetFloat("key", defaultValue) to get the float value saved under the key. If the key doesn't exist, it returns defaultValue.
Click to reveal answer
intermediate
What happens if you try to get a PlayerPrefs key that does not exist?
PlayerPrefs returns the default value you provide. If no default is given, it returns 0 for numbers or an empty string for strings.
Click to reveal answer
intermediate
How do you remove a saved key from PlayerPrefs?
Use PlayerPrefs.DeleteKey("key") to remove the saved data for that key.
Click to reveal answer
Which PlayerPrefs method saves a string value?
✗ Incorrect
PlayerPrefs.SetString saves a string value under a key.
What does PlayerPrefs.GetInt("score", 10) return if "score" is not saved?
✗ Incorrect
It returns the default value 10 because "score" does not exist.
How do you clear all saved PlayerPrefs data?
✗ Incorrect
PlayerPrefs.DeleteAll() removes all saved keys and values.
Which data types can PlayerPrefs store directly?
✗ Incorrect
PlayerPrefs supports int, float, and string types directly.
What is a good use case for PlayerPrefs?
✗ Incorrect
PlayerPrefs is best for small data like user settings, not large or complex data.
Explain how to save and retrieve a player's high score using PlayerPrefs.
Think about saving an integer and getting it back safely.
You got /3 concepts.
Describe what happens if you try to get a PlayerPrefs key that was never saved.
Consider what PlayerPrefs returns when data is missing.
You got /3 concepts.