Documentation

​
​

Development

User Acquisition

Monetization

Industry

Unity Gaming Services CLI

v1.5

Legacy
​

GitHub Repository

Unity Gaming Services CLI

v1.5

Legacy
​

Unity Gaming Services CLI
​
​
Cloud Code
  • Overview
  • Parameter parsing for scripts
  • Commands
  1. Overview
  2. Cloud Code

Parameter parsing for scripts

Understand how the create, update, and deploy commands parse parameters from a Cloud Code script.
Read time 2 minutes
Last updated 3 months ago

Create script, Update script, and Deploy commands evaluate parameters from a Cloud Code script.
In the example Script.js, one parameter with name
range
and type
NUMERIC
is parsed and uploaded to UGS.
For more details, check [Declare parameters in the script].
Warning
UGS CLI uses Node.js with version > 14.0.0 to parse Cloud Code parameters. Please install Node.js on your system and configure its executable path in your PATH environment variable.

Append Parameter into Cloud Code Script during Fetch

To ensure that the Fetch command is fetching the exact Cloud Code script information from the service, UGS CLI will look up parameters declared for the script in the service.
If there are parameters declared from the service and there are no parameter in service script code, the Fetch command will update local script code and declare parameters. This means a section like this might be appended into your local script code:
module.exports.params = { //Parameters declared in service}
If there are any parameters declared in-script from the service, UGS CLI will not update the parameters.
Warning
It is always recommended to declare and update parameters in-script code to prevent getting outdated parameters.

Parsing Limitations

Create script and Update script evaluate the given Cloud Code script to parse the parameters. As a result, these commands cannot parse parameters if you declare them at the beginning and overwrite/delete them after.
For example, this script is problematic:
const _ = require("lodash-4.17");const NUMBER_OF_SIDES = 6;module.exports.params = { sides: "NUMERIC"};module.exports = async ({ params, context, logger }) => { // ...};// Functions can exist outside of the script wrapperfunction rollDice(sides) { return _.random(1, sides);}
The script defines
module.exports.params
at the beginning, but then it is overwritten by
module.exports = async ...
, so Create script or Update script cannot parse the 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
    • Append Parameter into Cloud Code Script during Fetch

    • Parsing Limitations