Documentation

​
​

Development

User Acquisition

Monetization

Industry

Triggers

Triggers Admin API

Scheduler Admin API

Open Unity Dashboard

Triggers

LiveOps
​
​
Get started
  • Overview
  • Get started
  • Set up triggers example workflow
  • Authentication
Set up events
  • Understand and manage events
  • Schedule events
Define triggers
  • Define triggers
    • Trigger structure
    • Filters
    • Define triggers with the CLI
    • Define triggers with the REST API
    • Define triggers with the Unity Dashboard
Configure actions
  • Use Cloud Code
  • Use webhooks
Manage and monitor
  • Use the dead letter queue (DLQ)
  • Limits
  • Failure handling
Examples and reference
  • Use case samples
  1. Triggers
  2. Define triggers

Unity Gaming Services CLI

Manage trigger configurations from the command line using the Unity Gaming Services command-line interface.
Read time 2 minutes
Last updated 4 months 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:
  1. Install the UGS CLI.
  2. Configure your Project ID and Environment as such:
    ugs config set project-id <your-project-id>

    ugs config set environment-name <your-environment-name>
  3. 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.
Note
The
ugs triggers
command is also available as
ugs tr
.

Deploy triggers

Run the
new-file
command to create a trigger configuration locally:
ugs triggers new-file <file-name>
The configuration file contents can look like the following:
{ "$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 also modify a configuration file to include multiple triggers, or a mix of Cloud Code and webhook 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" }, { "Name": "example-webhook-trigger", "EventType": "com.unity.services.leaderboards.score-submitted.v1", "ActionUrn": "urn:ugs:webhook", "ActionType": "webhook", "Webhook": { "Url": "https://example.com/events", "Method": "POST", "Headers": { "Content-Type": "application/json" }, "PayloadTemplate": "{\"event\": \"score-submitted\", \"data\": {{.}}}" } } ]}
Important
If your trigger calls a scoped Cloud Code module endpoint, ensure that the triggering event has a scope type that matches the endpoint.
For webhook configuration details, refer to Webhooks.
You can use the
Deploy
command to promote your local trigger configuration files to the remote environment.
You need to deploy the configuration files for them to become active triggers:
ugs deploy <path-to-triggers-file> <path-to-triggers-file>
ugs deploy <path-to-directory>
If you associate the trigger with an existing Cloud Code script or module, then emitting the event with the specified
eventType
fires the trigger and executes the associated Cloud Code script or module.

Retrieve triggers

You can use the
Fetch
command to retrieve multiple triggers from remote at once.
The provided path is a directory where the triggers are saved to:
ugs fetch <path>

Delete triggers

To delete a trigger, you can run the
deploy
command with a
--reconcile
flag.
Warning
Reconcile is a destructive operation. It deletes all triggers that are not present in the provided path. You can check the output of the command with the
--dry-run
flag before running the command without it.
ugs deploy <path-to-triggers-file> --services triggers --reconcile

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Prerequisites

    • Using the CLI

      • Deploy triggers

      • Retrieve triggers

      • Delete triggers


Report a problem with this page