docs.unity3d.com

    Cloud Code Assets

    Creation

    Creating a Cloud Code Script can be done by right-clicking on the Project Window then selecting the Create > Cloud Code Script.

    Parameters

    Selecting a Cloud Code Script will allow you to modify its parameters in the inspector.

    Be advised that changing parameters on an existing script might make existing game clients incompatible. The client may send parameters that are incompatible, or not send required parameters.

    The possible parameter types are:

    • String
    • Boolean
    • Numeric
    • JSON
    • Any

    More details can be found in the Cloud Code Documentation.

    In-Script Parameters

    To allow a more seamless experience in your Cloud Code Scripts, you may declare your parameters directly in the script.

    To do so, simply export the params object, containing each parameter name as a key, and its type as a value.

    The module.exports property must have been assigned before setting the parameters.

    Example:

    module.exports.params = { "echo" : "Boolean" }
    

    Alternatively, if you'd like to specify that the parameter is required, you may specify an object containing both the type and required properties.

    Example:

    module.exports.params = { "aParam" : { "type": "String", "required": true } }
    

    By default, parameters are not required.

    Both formats can be combined as desired:

    module.exports.params = { 
      "echo" : "Boolean",
      "aParam" : { "type": "String", "required": true }
     }
    

    If you are using in-script parameters, they will override previously defined inspector parameters.

    In-script parameters offer a simpler alternative to declaring parameters, but the Unity Dashboard does not currently parse them if you try to update them without using this package.

    File Names

    Cloud Code assets use their file name as the identifier when uploading to the service.

    Naming Restrictions

    The Cloud Code service restricts the possible identifier names that can be used.

    In order to make sure your file uploads correctly, make sure to consult their documentation.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your 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.
    Generated by DocFX on 18 October 2023