Custom data
Learn how to attach additional JSON metadata to Economy resources to define custom properties.
Read time 1 minuteLast updated 13 days ago
You can attach custom data to Economy resources to define additional information that you want to store against any resource definition. Custom data is available for the following resource types:
- Currency
- Inventory items
- Virtual purchases
- Real money purchases
For example, custom data might include a resource description, the path to the texture that should be used to render the resource, or any additional resource properties that you want to change without having to rebuild your game. Custom data uses JSON format and is optional in your configuration. The maximum size for custom data is 5 KB.
For example, consider a Sword inventory item. You can add the following code in the Custom data field to assign the sword properties, as well as the path to find its image asset:
{ "damage": 5, "strength": 10, "durability": 20, "assetPath": "/assets/sword.png"}
The Custom Data editor comes with a built-in validation tool for JSON. Click BEAUTIFY to automatically reformat the code to optimize its legibility.
Instance data
An additional type of custom data is instance data, which is the data associated with a player’s instance of a particular inventory item. This data is set using the SDK or game API, uses the JSON format, and is visible using the Economy Find Player button in the Unity Dashboard. The main difference is that it does not relate to the configuration item, but to the specific player instance in the game.
Additional resources
- Introduction to resources in Economy
- Player data
- Custom data (Parameters of operation)