Editor tools
Use Economy scriptable objects in the Unity Editor to interact with Economy without running the game.
Read time 1 minuteLast updated a day ago
The Economy package comes with some Editor tools that provide more ways to interact with your game's Economy.
Scriptable objects
You can interact with your economy directly through the Unity Editor using the scriptable objects provided by the Economy package. There are scriptable objects for balances, inventories and virtual purchases. For these objects to work you need to follow the usual Economy setup flows, including configuring your Economy through the Unity Dashboard and signing in via Authentication. To create the objects, right-click in your project window, then Create > Economy Tools, and select the desired helper.Example workflow
- Create a button game object
- Create a new purchases helper in your project and configure the settings.
- Drag the purchases helper into the on click event of the button in the inspector.
- Select the method as the method to be triggered on click.
InvokeAsync()
Player balances helper
This helper allows you to set, increment and decrement a player's balance. When configuring your event, trigger theInvokeAsync()- : The method of interaction (set, increment or decrement).
Action - : The ID of the currency you want to modify.
Currency ID - : The amount by which you want to modify the currency.
Amount
Player inventories helper
This helper allows you to add and update player's inventory items. When configuring your event, trigger theInvokeAsync()- : The method of interaction (add or update).
Action - : The ID of the player's inventory item you want to add or update. If adding, you can leave this blank and an ID will be auto-generated for you.
Players Inventory Item ID - : Only required for the Add action. The inventory item ID of the item you want to add to the player's inventory.
Item ID - : Only required for the Update action. The instance data you want to add to the player's inventory item you are updating. This must be valid JSON.
Instance Data JSON
Purchases helper
This helper allows you to make purchases. When configuring your event, trigger theInvokeAsync()- : The ID of the virtual purchase you want to make.
Purchase ID