Unity Gaming Services CLI
Use the Unity Gaming Services command-line interface to create, deploy, and manage Cloud Code modules.
Read time 3 minutesLast updated 18 hours ago
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.
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.Create modules
To locally create a solution with a sample module, you can run thenew-fileThe 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.ugs cloud-code modules new-file <module-name> <module-directory>
Deploy modules
TheDeploy.ccmReleaseugs deploy <path-to-ccm-file> <path-to-sln-file>
ugs deploy <path-to-directory>
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,
<temp-folder>/<solution-name>.slnugs deploy <path-to-sln-file>
Deploy pre-compiled modules
To deploy pre-compiled modules, provide a path to a.ccmugs deploy <path-to-ccm-file>
Environment synchronization
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:You can then import the modules and deploy them to another environment by running the following command:ugs cloud-code modules export <out-dir> <file-name>
ugs cloud-code modules import <in-dir> <file-name> --environment-name <environment-name>
Retrieve modules
To get information about a single module that you deployed, run the following command: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 get <module-name>
ugs cloud-code modules list
Delete module
To delete a module, run the following command:ugs cloud-code modules delete <module-name>