Deploying resources with Unity Editor
Author and deploy Economy resources directly within the Unity Editor.
Read time 3 minutesLast updated a day ago
The Economy Authoring module (installed with the Economy package) allows you to optionally author and modify resources directly within the Unity Editor. You can then upload resources from the Unity Editor to the Dashboard by using the Deployment package. Economy resources existing in the Unity Editor allow users to treat their source control as the single source of truth (instead of the version in the cloud), simplifying actions such as rollbacks, bisection, and other common operations.
Prerequisites
To use Economy in the Unity Editor, you must first install the com.unity.services.economy SDK and link your Unity Gaming Services project to the Unity Editor.Link project
Link your Unity Gaming Services project with the Unity Editor. You can find your UGS project ID in the Unity Dashboard.- In Unity Editor, select Edit > Project Settings > Services.
-
Link your project.
-
If your project doesn't have a Unity project ID:
- Select Create a Unity Project ID > Organizations, then select an organization from the dropdown menu.
- Select Create project ID.
-
If you have an existing Unity project ID:
- Select Use an existing Unity project ID.
- Select an organization and a project from the dropdown menus.
- Select Link project ID.
-
If your project doesn't have a Unity project ID:
UnityEditor.CloudProjectSettings.projectIdInstall required packages
To create Economy resources within the Editor, you must install the following packages:- Deployment
- Economy (com.unity.services.economy@3.2.1 or greater)
To install these packages and add them to your list of available packages:
- From the Unity Editor’s Package Manager window, select + (add) > Add package by name….
- Enter .
com.unity.services.deployment - Select Add.
- Repeat these steps for .
com.unity.services.economy
Authoring within Unity Editor
The Economy Authoring module allows you to create, edit, and deploy Economy resources directly within the Unity Editor.Create a resource
Follow these steps to create an Economy resource using the Economy Authoring module:- In the Unity Editor, right-click in the Project window, then select Create > Services > Economy File.
- Choose and click on the desired resource file type to create between Currency, Inventory Item, Virtual Purchase and Real Money Purchase.
- Give the resource file a name.
- Press Enter.
Edit a resource
There is currently one method to edit an existing Economy resource:- In the Project tab, double-click the existing resource, then choose any text editor to edit the file.
Resource file content
The deployment window finds resources and assigns their type according to their file extension. Valid file extensions are.ecc.eci.ecv.ecrmy_currency.eccExample for{ "name": "MY_CURRENCY", "initial": 1, "max": 50}
my_inventory_item.eciExample for{ "name": "MY_ITEM"}
my_virtual_purchase.ecvExample for{ "name": "VIRTUAL_PURCHASE", "costs": [ { "resourceId": "MY_RESOURCE_ID", "amount": 2 } ], "rewards": [ { "resourceId": "MY_RESOURCE_ID_2", "amount": 6, "defaultInstanceData": null } ]}
my_real_money_purchase.ecrYou can find out which fields should be in your json by looking at the schema for each resource type here. Some fields may be omitted, such as{ "name": "MY_REAL_MONEY_PURCHASE", "storeIdentifiers": { "appleAppStore": "my_id", "googlePlayStore": "my_id" }, "rewards": [ { "resourceId": "MY_RESOURCE_ID", "amount": 6, "defaultInstanceData": null } ]}
idcustomDataidnameidnameidDeploy a resource
You can deploy an Economy resource through the Deployment window. See the Deployment package manual for more information. Some Economy resources have dependencies on other resources, such as Virtual Purchase resources having dependencies on Currency or Inventory Item resources. When deploying, the Currency and Inventory Item resources are always deployed first. When deploying Virtual Purchase or Real Money Purchase resources, make sure that the resources used forrewardscosts