Unity Gaming Services CLI
Manage trigger configurations from the command line using the Unity Gaming Services command-line interface.
Read time 2 minutesLast updated a month ago
You can use the Unity Gaming Services CLI to interact with triggers. The CLI allows you to manage trigger configurations from the command line.
Prerequisites
For a more comprehensive information on the CLI, follow the steps in the Unity Gaming Services CLI Get Started guide. To follow this guide, you first need to complete the following actions:- Install the UGS CLI.
-
Configure your Project ID and Environment as such:
ugs config set project-id <your-project-id>
ugs config set environment-name <your-environment-name> - Configure a Service Account with the required roles for Triggers and environments management. Refer to Get Authenticated.
Using the CLI
For a full reference of all commands and options, refer to the Triggers Command Line documentation.Deploy triggers
Run thenew-fileThe configuration file contents can look like the following:ugs triggers new-file <file-name>
You can also modify a configuration file to include multiple triggers:{ "$schema": "https://ugs-config-schemas.unity3d.com/v1/triggers.schema.json", "Configs": [ { "Name": "example-trigger", "EventType": "com.unity.services.scheduler.{{EVENT_NAME}}.v{{EVENT_VERSION}}", "ActionUrn": "urn:ugs:cloud-code:MyScript", "ActionType": "cloud-code" } ]}
You can use the{ "$schema": "https://ugs-config-schemas.unity3d.com/v1/triggers.schema.json", "Configs": [ { "Name": "example-trigger", "EventType": "com.unity.services.scheduler.{{EVENT_NAME}}.v{{EVENT_VERSION}}", "ActionUrn": "urn:ugs:cloud-code:MyScript", "ActionType": "cloud-code" }, { "Name": "example-trigger-2", "EventType": "com.unity.services.scheduler.{{EVENT_NAME}}.v{{EVENT_VERSION}}", "ActionUrn": "urn:ugs:cloud-code:MyScript", "ActionType": "cloud-code" } ]}
Deployugs deploy <path-to-triggers-file> <path-to-triggers-file>
If you associate the trigger with an existing Cloud Code script or module, then emitting the event with the specifiedugs deploy <path-to-directory>
eventTypeRetrieve triggers
You can use theFetchugs fetch <path>
Delete triggers
To delete a trigger, you can run thedeploy--reconcileugs deploy --services triggers <path-to-triggers-file> --reconcile