Unity Gaming Services CLI
You can use the Unity Gaming Services CLI to interact with Cloud Code scripts. The CLI allows you to create, deploy, and manage Cloud Code scripts from the command line.
For a deep dive into the CLI, follow the steps in the Unity Gaming Services CLI Get Started guide.
To follow this guide, you must first complete the following actions:
Configure your Project ID and Environment as such:
ugs config set project-id <your-project-id>
ugs config set environment-name <your-environment-name>
Using the CLI
Refer to the Cloud Code Command Line documentation for a full reference of all commands and options.
new-file command to create a script with sample code locally:
ugs cloud-code scripts new-file <file-name>
You can use the
Deploy command to promote your local scripts to the remote environment and publish them at once.
The local scripts must be deployed to become available to the game client.
ugs deploy <path-to-script-file> <path-to-script-file>
ugs deploy <path-to-directory>
To retrieve information about the deployed scripts, run the following command:
ugs cloud-code scripts get <script-name>
You can also list all scripts currently deployed to Cloud Code by running the following command:
ugs cloud-code scripts list
You can use the
Fetch command to retrieve multiple Cloud Code scripts from remote at once.
The provided path is a directory where the scripts will be fetched to:
ugs fetch <path>
You can move all your scripts from one environment and deploy them to another environment.
Run the following command to produce an archive of all the scripts in your current environment:
ugs cloud-code scripts export <out-dir> <file-name>
You can then import the scripts and deploy them to another environment by running the following command:
ugs cloud-code scripts import <in-dir> <file-name> --environment-name <environment-name>
The scripts are published automatically.
To delete an existing script, run the following command:
ugs cloud-code scripts delete <script-name>