Unity Gaming Services(Unity 游戏服务)CLI
Create, deploy, and manage Cloud Code scripts using the Unity Gaming Services command-line interface.
阅读时间3 分钟最后更新于 1 个月前
您可以使用 Unity Gaming Services(Unity 游戏服务)CLI 来处理 Cloud Code 脚本。借助 CLI 可以从命令行创建、部署和管理 Cloud Code 脚本。
先决条件
要深入了解 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> - 为服务帐户配置 Cloud Code 和环境管理所需的角色。请参阅接受身份验证。
使用 CLI
请参阅 Cloud Code 命令行文档,了解所有命令和选项的完整参考。部署脚本
运行new-file您可以使用ugs cloud-code scripts new-file <file-name>
Deployugs deploy <path-to-script-file> <path-to-script-file>
ugs deploy <path-to-directory>
获取脚本
要获取已部署的脚本的相关信息,请运行以下命令:还可以通过运行以下命令列出当前部署到 Cloud Code 的所有脚本:ugs cloud-code scripts get <script-name>
您可以使用ugs cloud-code scripts list
Fetchugs fetch <path>
环境同步
您可以将所有脚本从一个环境移动并部署到另一个环境。 运行以下命令以生成当前环境中所有脚本的存档:然后,可以通过运行以下命令导入脚本并部署到另一个环境:ugs cloud-code scripts export <out-dir> <file-name>
脚本会自动发布。ugs cloud-code scripts import <in-dir> <file-name> --environment-name <environment-name>
删除脚本
要删除现有脚本,请运行以下命令:ugs cloud-code scripts delete <script-name>