Cloud Code JavaScript scripts
Cloud Code scripts are written in JavaScript. You can call these scripts from games by using an HTTP request. Write, test, and debug scripts from the Unity Dashboard in the same place you define the configuration for other services, such as Remote Config.
Typical workflow
The following process details a typical development cycle:
- Create a script. You can create a Cloud Code script through the Unity Dashboard. Select the type (currently only API scripts are supported) and add custom parameters.
- Write the code. Build from the example scripts or start from scratch. Easily integrate with other Unity services by using the Cloud Code API clients.
- Test and debug. Select Run on the dashboard and test the result of your function. Use the provided test players to validate the interaction with other services or add logging statements to debug issues. Refer to Test running the script.
- Publish the script. Select Publish, makes the script available to the game client. This is the main mechanism for doing live updates on scripts, which are immediately displayed in the game.
- Integrate the script with your project. Import the Cloud Code SDK into your game and use one of the provided methods to call your script. Refer to Call from Unity Runtime.
Example use cases
You can write much of your game logic with Cloud Code. However, it might not be obvious how to connect different services from within scripts or how doing so would fit in as a game mechanic. Explore the use cases to better understand Cloud Code scripts and what problems they can solve. Examples include server time anti-cheat mechanisms, in-game coupons, and daily rewards.
For more advanced use, download the Unity Gaming Services Samples project to learn how to solve common game development challenges with Cloud Code, and read the Advanced use cases.