Documentation

​
​

Development

User Acquisition

Monetization

Industry

Cloud Code

Scripting API

Services C# SDKs

Services JavaScript SDKs

Admin REST API

Client REST API

Scheduler Admin REST API

Observability REST API

Open Unity Dashboard

Cloud Code

LiveOps
​
​
Cloud Code
  • Overview
  • Get started
  • Server authority
  • Cloud Code C# modules
    • Overview
    • Get started
    • Concepts
    • Tutorials
      • Run modules
      • Write modules
      • Development essentials
      • Automate deployment
        • Integrate with CI/CD
        • Automate local deployment
      • Integrate services
      • Advanced configuration
      • Use Cases
    • Reference
  • Cloud Code JavaScript scripts
  • Logging
  • Use-case samples
  • Privacy and consent
  1. Cloud Code

Automate local deployment

Automate the deployment of your Cloud Code module with the Unity Gaming Services CLI or project file.
Read time 3 minutes
Last updated 9 months ago

This guide shows you how to automate the deployment of your Cloud Code module with the Unity Gaming Services (UGS) CLI or the project file.
If you want to integrate the deployment into your CI/CD pipeline, refer to Integrating with CI/CD.

Prerequisites

You need a Cloud Code module and the UGS CLI to automate local deployment:
  1. Create a Cloud Code module.
  2. Follow the steps in Install the CLI (Unity Gaming Services CLI) to install, configure and authenticate the UGS CLI.

Automate with the UGS CLI

The UGS CLI provides a
deploy
command that you can use to deploy a solution. The
deploy
command zips the module and deploys it to the Cloud Code service.
To deploy, run the following command from your terminal in your project directory:
ugs deploy <path_to_solution>
Note
To support compilation, the solution needs to contain a publish profile for the main project. For more information, refer to Deploy C# solutions.

Automate using the project file

You can use the project file to automate the deployment of your Cloud Code module if you configure the project file to publish, zip and deploy your project on build.
Note
This is an advanced workflow. For most cases, the UGS CLI Deploy command is sufficient.
For more information, refer to Microsoft guide on Understanding the project file.
The script uses the UGS CLI Deploy command.

Project file configuration

You can use the following project file configuration to automate the deployment of your Cloud Code module:
<Target Name="RemoveDirectory"> <RemoveDir Directories="$(OutDir)Module/" /> </Target><Target Name="PublishModule" DependsOnTargets="RemoveDirectory"> <Exec Command="dotnet publish -r linux-x64 --no-self-contained -o $(OutDir)Module/$(AssemblyName)" /></Target><Target Name="ZipModule" DependsOnTargets="PublishModule"> <ZipDirectory SourceDirectory="$(OutDir)Module/$(AssemblyName)" DestinationFile="$(OutDir)Module/$(AssemblyName).ccm" /></Target><Target Name="DeployModule" DependsOnTargets="ZipModule"> <Exec Command="ugs deploy $(OutDir)/Module/$(AssemblyName).ccm" /></Target>
Copy and paste the above configuration into your project file.
  • The
    RemoveDirectory
    target removes the
    Module
    directory from the
    OutDir
    directory.
  • The
    PublishModule
    target publishes the module to the
    Module
    directory and produces the required assemblies.
  • The
    ZipModule
    target zips the
    Module
    directory.
  • The
    DeployModule
    target deploys the module to the Cloud Code service.

Ready to Run compilation (optional)

Ready to Run compilation is an optional feature that improves the cold start time of your Cloud Code module. To check how this option affects your module, refer to Ready to Run.
To enable Ready to Run compilation, modify the
PublishModule
target to include the
PublishReadyToRun
property:
<Target Name="PublishModule" DependsOnTargets="RemoveDirectory"> <Exec Command="dotnet publish -r linux-x64 -p:PublishReadyToRun=true --no-self-contained -o $(OutDir)Module/$(AssemblyName)" /> </Target>

Running targets

To run the targets, run the following command from your terminal in your project directory:
msbuild /t:DeployModule
If the
msbuild 
command is not found, you may need to add the
msbuild
path to your
PATH
environment variable.
Note
You can run any of the other targets individually if you replace
DeployModule
with another target name. The targets are dependent on each other, so any target that you run also runs the targets it depends on.

Expected output

If the deployment is successful, the following output is displayed:
Deployed: ExampleModule.ccm

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Prerequisites

    • Automate with the UGS CLI

    • Automate using the project file

      • Project file configuration

        • Ready to Run compilation (optional)

      • Running targets

      • Expected output


Report a problem with this page