Saving and loading player data – using PlayerPrefs
While the previous recipe illustrates how the static properties allow a game to remember values between different scenes, these values are forgotten once the game application has quit. Unity provides the PlayerPrefs
feature to allow a game to store and retrieve data, between the different game playing sessions.
Getting ready
This recipe builds upon the previous recipe. In case you haven't completed the previous recipe, we have included a Unity
package named game_scoreStaticVariables
in the the 1362_10_05
folder. In order to follow this recipe using this package, you must do the following:
- Create a ...
Get Unity 5.x Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.