Unity Gaming Services CLI
Create, deploy, and manage Cloud Code scripts using the Unity Gaming Services command-line interface.
Read time 2 minutesLast updated a day ago
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.
Prerequisites
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:- Install the UGS CLI.
-
Configure your Project ID and Environment as such:
ugs config set project-id <your-project-id>
ugs config set environment-name <your-environment-name> - Configure a Service Account with the required roles for Cloud Code and environments management. Refer to Get Authenticated.
Using the CLI
Refer to the Cloud Code Command Line documentation for a full reference of all commands and options.Deploy scripts
Run thenew-fileYou can use theugs cloud-code scripts new-file <file-name>
Deployugs deploy <path-to-script-file> <path-to-script-file>
ugs deploy <path-to-directory>
Retrieve scripts
To retrieve information about the deployed scripts, run the following command:You can also list all scripts currently deployed to Cloud Code by running the following command:ugs cloud-code scripts get <script-name>
You can use theugs cloud-code scripts list
Fetchugs fetch <path>
Environment synchronization
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:You can then import the scripts and deploy them to another environment by running the following command:ugs cloud-code scripts export <out-dir> <file-name>
The scripts are published automatically.ugs cloud-code scripts import <in-dir> <file-name> --environment-name <environment-name>
Delete script
To delete an existing script, run the following command:ugs cloud-code scripts delete <script-name>
Additional resources
- Deploy Samples
- Refer to Parameter parsing to understand how the commands treat script parameters.