To get Cloud Code working with your project, you first need to link your project to the Unity Dashboard. Afterward, access Unity services, enable your project in the Dashboard, and install the SDK in Unity Editor.

To use the Cloud Code service, you must link your project with the Unity Dashboard.

  1. In Unity Editor, select Edit > Project Settings > Services.

  2. Link your project.

    • If your project doesn't have a Unity project ID:

      1. Select Create a Unity Project ID > Organizations, then select an organization from the dropdown menu.
      2. Select Create project ID.
    • If you have an existing Unity project ID:

      1. Select Use an existing Unity project ID.
      2. Select an organization and a project from the dropdown menus.
      3. Select Link project ID.

Your Unity Project ID appears, and the project is now linked to Unity services. You can also access your project ID in a Unity Editor script using UnityEditor.CloudProjectSettings.projectId.

Unity Dashboard

You can access Cloud Code directly from the Unity Dashboard:

  1. Go to the Unity Dashboard.
  2. Sign in by using your Unity ID.
  3. In the Main Menu, select Explore Services (if not already selected).
  4. In the main window, under either the All Solutions or LiveOps tabs, select Cloud Code.

SDK installation

To install the latest Cloud Code package for Unity:

  1. In the Unity Editor, open Window > Package Manager.
  2. In the Package Manager, select the Unity Registry list view.
  3. Search for, or locate the Cloud Code package in the list.
  4. Select the package, then click Install.

See the Package Manager documentation for more information.

For detailed SDK documentation, see Cloud Code SDK API.

SDK setup

The Cloud Code SDK is ready to use once you have signed in with the Authentication SDK. The Cloud Code SDK requires authoring one or more cloud scripts in the Cloud Code dashboard. You can then call any Cloud Code methods to start interacting with your data.

Before you continue, make sure you complete the SDK installation.

To get started with the Cloud Code SDK:

  1. Ensure the service is enabled via the Cloud Code service dashboard page.
  2. Ensure that you have installed both the Cloud Code and the Authentication SDKs.
  3. Sign into your cloud project from within Unity Editor by selecting Edit > Project Settings... > Services.
  4. Create a new C# Monobehaviour script in Unity Editor. See Creating and using scripts in the Unity Manual.
  5. In the script, initialize the Core SDK using await UnityServices.InitializeAsync().
  6. In the script, initialize the Authentication SDK.

Players must have a valid player ID and access token to access the Cloud Code services. You must authenticate players with the Authentication SDK before using any of the Cloud Code APIs. You can do this with the following code snippet for anonymous authentication or see the documentation for the Authentication SDK for more details and other sign-in methods.


await AuthenticationService.Instance.SignInAnonymouslyAsync();

See Unity Editor integration for examples and information about setting up the script.


Apps typically need to know the identity of a user to provide a variety of features and services to both game developers and players to ensure security, consistency, and safety with every interaction. Each player must have a valid player ID and an access token to access the Cloud Code services. See Unity Editor integration: Authentication.

Writing your first script

You can define a simple "hello world" script in Cloud Code to test the service. Use the Unity Dashboard to create a new script with a name parameter of type string. For more detailed instructions, see Script creation.

You can then use the following snippet as your code.


module.exports = async ({ params, logger }) => {
  const name =;
  const message = `Hello, ${name}. Welcome to Cloud Code!`  
  return {
    welcomeMessage: message

Save the changes and publish your script. Once you publish it, you can call a Cloud Code script from a project using one of the SDK endpoints, as shown in the following example.


using System.Collections.Generic;
using Unity.Services.Authentication;
using Unity.Services.CloudCode;
using Unity.Services.Core;
using UnityEngine;

 * Note: You must have a published script to use the Cloud Code SDK.
 * You can publish a script from the Unity Dashboard -
public class CloudCodeExample : MonoBehaviour
     * CloudCodeResponse represents the response from the script, used for deserialization.
     * In this example, the script returns a JSON in the format
     * {"welcomeMessage": "Hello, arguments['name']. Welcome to Cloud Code!"}
    class CloudCodeResponse
        public string welcomeMessage;

     * Initialize all Unity Services and Sign In an anonymous player.
     * You can perform this operation in a more centralized spot in your project
    public async void Awake()
        await UnityServices.InitializeAsync();
        await AuthenticationService.Instance.SignInAnonymouslyAsync();

     * Populate a Dictionary<string,object> with the arguments and invoke the script.
     * Deserialize the response into a CloudCodeResponse object
    public async void OnClick()
        var arguments = new Dictionary<string, object> { { "name", "Unity" } };
        var response = await CloudCodeService.Instance.CallEndpointAsync<CloudCodeResponse>("hello-world", arguments);

See Integration with other Unity services to learn how to use Cloud Code with other Unity services.