Develop Cloud Code modules in the Unity Editor
Create, compile, and deploy Cloud Code modules in the Unity Editor as Unity Cloud Code modules (.ccmu).
Read time 5 minutesLast updated 2 days ago
You can create, compile, and deploy Cloud Code modules entirely within the Unity Editor. A module created in this way is called a Unity Cloud Code module (UCCM), and its asset file carries the extension.
.ccmuUCCMs are the recommended way to author Cloud Code modules in the Unity Editor. They bring the entire module workflow into the Editor, automating some processes and improving iteration time, and build on the same logic and concepts as the module reference workflow, with the following additional key features:
- Develop Cloud Code modules using the standard Unity Editor script workflow. Scripts are created and compiled directly in the Editor, but their contents are edited in your currently configured External Script Editor.
- Unity Cloud Code modules compile automatically during the standard Editor compilation pass, so you don't have to manually generate bindings.
- Debugging is built-in by default and integrated into the Editor.
Prerequisites
Before you create a Unity Cloud Code module, set up the Unity Editor and install the required packages. Follow the set up the Unity Editor steps in the Cloud Code modules getting started guide.
Create a Unity Cloud Code module
You can create a new UCCM directly within the Unity Editor.
To create a Unity Cloud Code module:
- In the Project window, select or create a folder to contain your module.
- Right-click in the folder, then select Create > Services > Cloud Code Module Script. The Cloud Code Script appears in your folder.
- Optionally rename the script, then press Enter to accept the script.
- In the Cloud Code Module Creator dialog that opens, select the Cloud tab, where you can do the following:
- In the Cloud Code Script field, optionally rename the C# script.
- In the Cloud Code C# Module field, optionally rename the module.
- Verify the remaining paths and file names for the other resources in the Cloud and Client tabs.
- Select Confirm.
- If required, repeat steps 1 to 3 to create another script. Creating a script in the same folder automatically adds it to the module.
The previous procedure generates the following:
- A folder containing a Cloud Code script and an Assembly Definition. Write your module logic here. You can add more scripts to this folder.
Cloud - A folder containing a client script and an Assembly Definition. This client script is an empty partial class containing a reference to a generated file that's updated automatically from your Cloud Code scripts.
Client - A Unity Cloud Code module asset () in the parent folder, pointing to both Assembly Definitions. Use this file to deploy the module in the Deployment window.
.ccmu
Deploy the module
The module appears in the Deployment window as a Cloud Code Module. From the Deployment window, you can deploy the module to a remote environment or to a local Cloud Code server if you have one running.
The following diagram shows how a module moves through deployment. The diagram also demonstrates how a function call routes to the Cloud Code service or a local server, depending on whether the local server is running when you enter Play mode.
To deploy the module to a remote environment:
- In the Unity Editor, open the Deployment window.
- Select the Cloud Code Module.
- Select Deploy Selected.
A successful deployment shows a green checkmark next to the module in the Deployment window.
To learn how to call your deployed module endpoints from your game, refer to Run modules in Unity Runtime.