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
  • Cloud Code JavaScript scripts
    • Overview
    • Get started
    • Concepts
    • Tutorials
      • Run scripts
      • Write scripts
        • Using the Unity Dashboard
        • Using Unity Editor
        • Using the CLI
        • Using the REST API
      • Interact with cross-player data
      • Integrate with CI/CD
      • Use Access Control
      • Test run a script
      • Integrate with other Unity Services
      • Integrate with external services
      • Use Cases
    • Reference
  • Logging
  • Use-case samples
  • Privacy and consent
  1. Cloud Code
  2. Write scripts

Unity Gaming Services CLI

Create, deploy, and manage Cloud Code scripts using the Unity Gaming Services command-line interface.
Read time 2 minutes
Last updated 9 months 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:
  1. Install the UGS CLI.
  2. Configure your Project ID and Environment as such:
    ugs config set project-id <your-project-id>

    ugs config set environment-name <your-environment-name>
  3. 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.
Note
The
ugs cloud-code scripts
command is also available as
ugs cc s
.

Deploy scripts

Run the
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>

Retrieve scripts

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>
Note
If there are parameters declared from service, and there's no parameter in service script code, the Fetch command will update the local script code and append parameters to it. Refer to Parameter parsing.

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:
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.
Note
Import
does not overwrite your environment by default. If you would like to delete existing scripts before importing, use the
--reconcile
flag.

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.

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

    • Using the CLI

      • Deploy scripts

      • Retrieve scripts

      • Environment synchronization

      • Delete script

    • Additional resources


Report a problem with this page