Getting Started
Unity Package Types
Components
Economy
Scripting
Guidelines
Support
Data Store
Overview
Data Store allows you to save state for your experience. It is commonly used to store user state such as inventory items (if you choose not to use backpack), XP, level, etc.
The Data Store system supports multiple scopes, however in the short term it is limited to storing data on a per user basis.
Terminology
Scope | “Area” of storage. Currently only UserWorldData is supported, this allows you to store state per-user per-world. |
Key | The full “path” of the variable. For example inventory/cats |
Variable Name | The name of an individual variable in a “key”. For example cats inside inventory/cats |
Interface
The main two nodes that you will likely use are Get Variable
and Set Variable
The data store nodes are asynchronous, which means that they don’t execute immediately and have delayed response. To make the nodes work, make sure that the first node in the execution flow is marked as a “Coroutine”.
These are all the available scripting nodes
- Get Variable
- Set Variable
- Delete Variable
- Clear All Variables — Clear the entire state
- Has Variable — Check if a variable exists
- Has Any Variable — Check if there is anything in the current data store scope
- Dump as JSON String — Useful for debugging, this outputs a string which you can
Debug Log
into the console.
Limits & Constraints
Supported Types
You can store values in any of the following types. If an unsupported type is used, the node will fail.
int
bool
float
double
long
decimal
string
Vector2
Vector3
Vector4
Quaternion
Color
DateTime
int[]
bool[]
float[]
string[]
Dictionary<string, SUPPORTED_DATA_TYPE>
Key & Variable Names
- Max variable nested depth is 10
- Max variable name length is 64
- Max key length is 400
- Variable names cannot start with a number
- Variable names can only contain alphanumeric characters (
a-z A-Z 0-9
) and_
- Variable names cannot start or end with
__
Data Size & Bandwidth
- The maximum size of of the total storage (per user) is
1MB
- Data store mutations (set value) are rate limited to 10 requests per minute. Changes made in the same update frame are batched together, and only count as a single mutation.
← Previous