Persistent Storage allows you to save player data between play sessions.
To save player's equipment, resources, level, or any other value that you associate with players, you can use Persistent Storage. This is a table of data organized by player, that will allow you access data for currently connected players.
To save and use data for all players who have ever accessed the game, regardless of whether or not they are currently connected, use a Global Leaderboard.
For a complete tutorial on using Persistent Storage to save player resources and equipment, see the Persistent Storage Tutorial
Using Persistent Storage¶
Storage is not enabled by default, and must be turned on for any project that will use shared data tables.
- Select the Game Settings object in the Hierarchy and open the Properties window.
- In the General section, check the box next to Enable Player Storage
Update Player Data¶
After enabling Player Storage, updating a value in the data table is a three step process. To learn more about working with Storage, see the Core API
- Create a variable and assignt it to the player's data table using
- Change a value on the table like any other table. See the Lua Fundamentals reference for more information about how to do this.
- Replace the player's old table with the modified one using
For examples of using Persistent Storage, see the [Persistent Storage Examples](persistent_storage_tutorial.md