Unity Cloud Dashboard

The Unity Cloud Dashboard is a simple way to get started as it allows you to take full control of your triggers through a graphical interface. This section covers how you can preview, create and delete your triggers.

Note: The Unity Cloud Dashboard only supports event-based UGS trigger. To create scheduled events and triggers for scheduled events, you can use the CLI or the Triggers Admin API.

Preview triggers

You can access a list of all triggers for an environment from the Unity Cloud Dashboard:

  1. In the Unity Cloud Dashboard, select Cloud Code.
  2. Select Triggers.
  3. Select an environment from the list of environments.

A list of all triggers in the selected environment for the project appears. The table contains the name, trigger, type, and last updated timestamp.

Trigger details

You can navigate to the trigger details page by selecting a trigger from the list of triggers. The trigger details page shows you the following information:

DataDescription
NameThe name of the trigger.
TypeThe type of trigger: Event or Schedule.
TriggerThe event that triggers the script. For example, key_saved by Cloud Save.
Event TypeThe full event type, for example, com.unity.services.cloud-save.key-saved.v1. For more information on event types, refer to Event structure.
Last updatedThe RFC3339 timestamp of the last time the trigger configuration was updated.

The trigger definition card shows a breakdown of the trigger configuration:

  • when this happens (event type)
  • where (filters)
  • do this (action, Cloud Code script or module)

The filters are displayed in a chips, showing the attribute, operator, and value of the filter. If the dashboard can't display the filter in the chip format, the dashboard displays the filter in its original CEL format.

To navigate to the logs page for trigger and view the logs for the trigger execution, select the View Trigger Logs button. Learn more about logs in the Logs section.

If the trigger is associated with an existing script or module, the trigger definition card provides a link to the script or module. To navigate to the script or module details page, select the link.

Create a trigger

You can create an event-based trigger in the Unity Cloud Dashboard.

  1. In the Unity Cloud Dashboard, select Products > Cloud Code.

  2. Select Triggers.

  3. Select New trigger.

  4. Fill in the following information:

    • Name: A name for your trigger, used to identify the configuration. Trigger names must be unique across the project and environment and not exceed 255 characters.
    • Type: The type of the trigger. Event-based triggers refer to triggers triggered by UGS-emitted events.
  5. Select Next.

  6. In the next step, select the following information:

    • In the When this happens section:

      1. Select the Add Trigger Event button.

      2. Select the event you want to trigger the script.

      3. Select Add Filter to add a filter to the event.

      Note: You do not need to encase the string values for quotes. However, you must encase the values for JSON types in quotes.

    • In the Do this section:

      1. Select the Add Action dropdown.

      2. Select the action you want to perform when the trigger is activated. This action can be a script or a module.

      Note: You can only select Cloud Code actions that are in the same environment as the trigger. If you selected a Moderation event in the When this happens section and want to a select script for your action, you can only select a Moderation script.

  7. Select Confirm.

Trigger creation redirects you to the trigger list page. To inspect the trigger configuration, select the trigger name in the table.

Warning: If the trigger interacts with the same service that emits the event, you should define a filter to avoid infinite loops. Refer to Filters in the Unity Cloud Dashboard for samples.

Filters in the Unity Cloud Dashboard

You can add filters to the trigger configuration to specify the conditions under which the trigger activates. The Unity Cloud Dashboard supports a limited set of filters that you can use to filter the event payload.

Familiarize yourself with how filters work in the Filters section. Refer to Supported UGS events to inspect event payloads for each UGS event.

Note: The Unity Cloud Dashboard provides a limited amount of operators to offer a simple approach to filters. You cannot define type casting, nested expressions, or complex expressions in the Unity Cloud Dashboard. If you need more advanced filters, use the CLI or the Triggers API to define your own CEL expressions.

Warning: If your trigger interacts with the same service that emits the event, you need to define a filter to avoid infinite loops. Infinite loops over-process the event, cause unexpected behavior in your game, and eventually exhaust your Cloud Code resources for the project, which leads to a service outage.If you encounter this issue, delete the trigger that is causing the loop.

Supported operators

The Unity Cloud Dashboard displays different operators depending on the attribute type:

OperatorSupported by
equals toAll attribute types
not equals toAll attribute types
greater thanint, double and JSON types
greater than or equals toint, double and JSON types
less thanint, double and JSON types
less than or equals toint, double and JSON types
matchesstring and JSON types
not matchesstring and JSON types
containsstring and JSON types
starts withstring and JSON types
ends withstring and JSON types

Note The JSON type refers to any JSON object, string, number or boolean. Although all operators are supported for JSON types, you need to use the correct operator for the attribute type within the JSON object. For example, you can't use a string operator for a JSON number.

Join filters

You can define up to 10 filters for a trigger. You can join filters by the logical operators AND and OR. You can use these operators to combine multiple filters to create complex conditions.

Note The Unity Cloud Dashboard doesn't support nested expressions. You can only join filters with the logical operators AND and OR. If you need more advanced filters, use the CLI or the Triggers API to define your own CEL expressions.

Define filters with the Cloud Save key-saved event

You can define your trigger to only activate when a specific key is saved in Cloud Save. For example, you can define a filter to only activate the trigger when the key playerData is saved.

In the Unity Cloud Dashboard, you can add this filter to the trigger configuration:

  1. In the When this happens section, select the Add Event button.
  2. Select the event dropdown and choose the Cloud Save key-saved event.
  3. Select the Add Filter button.
  4. In the new Filter card:
    1. In the first dropdown, select the key attribute.
    2. In the second dropdown, select the equals to operator.
    3. In the third dropdown, enter the value playerData.

If you define this filter, you ensure that the trigger only activates when the key playerData is saved in Cloud Save.

Define filters with the Leaderboards score-submitted event

You can define your trigger to only activate when a specific score is submitted to a leaderboard. For example, you can define filters to only activate the trigger for a score in a specific range.

In the Unity Cloud Dashboard, you can add this filter to the trigger configuration:

  1. In the When this happens section, select the Add Event button.
  2. Select the event dropdown and choose the Leaderboards score-submitted event.
  3. Select the Add Filter button.
  4. In the new Filter card:
    1. In the first dropdown, select the score attribute.
    2. In the second dropdown, select the greater than operator.
    3. In the third dropdown, enter the value 0.
  5. Select the Add Filter button.
  6. In the new Filter card:
    1. In the first dropdown, select the score attribute.
    2. In the second dropdown, select the less than operator.
    3. In the third dropdown, enter the value 100.

If you define this filter, you ensure that the trigger only activates when a score between 0 and 100 is submitted to a leaderboard.

Delete a trigger

To delete triggers from the Unity Cloud Dashboard:

  1. Navigate to the Triggers list page.
  2. Select the bin icon. A dialog appears to warn you that trigger deletion can't be undone.

    Note: If you delete a trigger that is in use by a live game, you may cause unexpected behavior in your game.

  3. Select Delete to confirm the deletion.

Alternatively, you can navigate to the trigger details page and select the Delete button to delete the trigger.