Unity Gaming Services CLI
You can use the Unity Gaming Services CLI to interact with Cloud Code modules. The CLI allows you to create, deploy, and manage Cloud Code modules 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.
To locally create a solution with a sample module, you can run the
ugs cloud-code modules new-file <module-name> <module-directory>
The command creates a new solution with a sample module.
You can either use the solution as it is or modify it to suit your needs.
Deploy command allows you to deploy Cloud Code modules to the remote environment.
The command supports both pre-compiled modules in
.ccm format and C# solutions, which automatically compile and zip before deployment.
To deploy multiple modules at once, either provide multiple file paths or a directory containing multiple files:
ugs deploy <path-to-ccm-file> <path-to-sln-file>
ugs deploy <path-to-directory>
Deploy pre-compiled modules
To deploy pre-compiled modules, provide a path to a
.ccm file as an argument to the command:
ugs deploy <path-to-ccm-file>
To learn how to compress your module into a
.ccm file, refer to Package code.
Deploy C# solutions
You can deploy C# solution and have it automatically compile and zip before deployment.
To support compilation, the solution must contain a publish profile for the main project.
Refer to specific IDE documentation to learn how to create a publish profile:
- JetBrains Rider - Publish profiles
- Visual Studio - Visual Studio publish profiles (.pubxml) for ASP.NET Core app deployment
- Visual Studio - Publish to a folder using Visual Studio for Mac
When deploying solutions, they automatically compile and zip before deployment.
The result saves your local temporary folder (for example,
To deploy C# solutions, provide a path to a
.sln file as an argument to the command:
ugs deploy <path-to-sln-file>
You can move all your modules from one environment and deploy them to another environment.
Run the following command to produce an archive of all the modules in your current environment:
ugs cloud-code modules export <out-dir> <file-name>
You can then import the modules and deploy them to another environment by running the following command:
ugs cloud-code modules import <in-dir> <file-name> --environment-name <environment-name>
To get information about a single module that you deployed, run the following command:
ugs cloud-code modules get <module-name>
The module name is the name of the .NET class library that is contained within the .ccm archive. You can also list all modules currently deployed to Cloud Code by running the following command:
ugs cloud-code modules list
To delete a module, run the following command:
ugs cloud-code modules delete <module-name>