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.
For a complete tutorial on using Persistent Storage to save player resources and equipment, see the Persistent Storage Tutorial
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
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 assign 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
Storage is available in a read-only format for players who are offline as well. See the Offline Storage Reference for more information.