Unity Gaming Services(Unity 游戏服务)CLI
Manage trigger configurations from the command line using the Unity Gaming Services command-line interface.
阅读时间2 分钟最后更新于 1 个月前
您可以使用 Unity Gaming Services(Unity 游戏服务)CLI 来处理触发器。通过 CLI 可以从命令行管理触发器配置。
先决条件
如需了解 CLI 更全面的信息,请按照 Unity Gaming Services(Unity 游戏服务)CLI 入门指南中的步骤操作。 为了按照该指南操作,首先需要完成以下操作:- 安装 UGS CLI。
-
按如下方式配置 Project ID 和环境:
ugs config set project-id <your-project-id>
ugs config set environment-name <your-environment-name> - 为服务帐户配置 Triggers 和环境管理所需的角色。请参阅接受身份验证。
使用 CLI
如需了解所有命令和选项的完整参考,请参阅 Triggers 命令行文档。部署触发器
运行new-file配置文件内容可能如下所示:ugs triggers new-file <file-name>
还可以修改配置文件来包含多个触发器:{ "$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" } ]}
您可以使用{ "$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>
如果您将触发器与现有 Cloud Code 脚本或模块相关联,则发出指定ugs deploy <path-to-directory>
eventType获取触发器
您可以使用Fetchugs fetch <path>
删除触发器
要删除触发器,您可以运行带--reconciledeployugs deploy --services triggers <path-to-triggers-file> --reconcile