Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Official Cloud Code JS Authoring tool from the Editor - Officially Released!

Discussion in 'Cloud Code' started by JGasimov, Apr 11, 2023.

  1. JGasimov

    JGasimov

    Unity Technologies

    Joined:
    Feb 24, 2022
    Posts:
    8
    rw-2.gif

    Welcome to the Cloud Code JS Authoring tool from the Editor discussion thread. You can use this thread to ask for help, share feedback and have discussions about the com.unity.services.cloudcode@2.1.1 package and the new feature enabled by the com.unity.services.deployment@1.0.0. This is the next step from our previous pre-release announcement.

    Introduction

    Introducing a new feature to Cloud Code to author it more easily! We are happy to bring all of the workflows you use on the Unity Dashboard to the Unity Editor!

    With Cloud Code Authoring you do not have to leave the Unity Editor more than you need to, it allows you to:
    • Author and modify the Cloud Code JS scripts in the Editor.
    • Use the source control of your choice as a source of truth.
    • Deploy your assets from the Editor manually or by simply entering Play Mode!
    • Increment faster!
    To get started please follow Script authoring within the Unity Editor.

    Note: This feature is also available for Remote Config.

    Requirements
    • This feature is only available Unity Editor 2021.3+
    • To use this feature you need to get the com.unity.services.deployment@1.0.0 package and the com.unity.services.cloudcode@2.1.1.
    Feedback

    At Unity, we put the Users First so your feedback is extremely valuable to us. Please share your feedback in this thread so that we can continue improving our tools for you!

    How to report bugs

    Ideally we'd like any bugs reported through the built in bug reporter tool, as that will automatically provide us with some relevant context.

    Once you have submitted a bug report through the bug reporter, please feel free to start a discussion about it in this thread.

    Thank you for your interest, we're looking forward to your feedback!
     
    Last edited: Apr 11, 2023
  2. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    I have some js scripts already in my project but it doesn't appear in the deploy window and dragging the scripts into the window doesn't add them to the list.

    I then created new cloud code js scripts from the create menu and copied over the code and the scripts did appear in the deploy window but the next time I opened the editor the deploy window was empty again.

    Please add a way to deploy existing files.

    Unity 2022.2.12
    deployment 1.0.0
    cloud code 2.3.1
     
  3. GabKBelmonte

    GabKBelmonte

    Unity Technologies

    Joined:
    Dec 14, 2021
    Posts:
    63
    Hi Spinaljack,

    What extension do they have?

    Can you try right clicking on those assets, and reloading them? Reloading assets is necessary for them to be recognized as part of the deployment window.

    Restart the editor and let me know if the assets remain in the window, if not we'll create a ticket and investigate more deeply.

    Cheers!
     
  4. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    Restarting the editor clears the list and makes it blank.


    Right clicking the .js files and reimporting did add them to the list.
    Would prefer a refresh button on the window itself and keep the files in the list after a restart.
     
    Last edited: Apr 24, 2023
  5. DSchroer-Unity

    DSchroer-Unity

    Unity Technologies

    Joined:
    May 19, 2021
    Posts:
    5
    Hey Spinaljack,

    The scripts should stay in the list. When you say it is blank, do you mean fully empty or is there a warning/other message this is displayed? Also have you by any chance reset the scripts meta files between reimport and it going blank?
     
  6. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    The list is empty, there's no error. I just close unity and reopen it.
     
  7. DSchroer-Unity

    DSchroer-Unity

    Unity Technologies

    Joined:
    May 19, 2021
    Posts:
    5
    Would you mind posting a screenshot?
     
  8. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    After Restart:
    upload_2023-4-24_15-27-21.png

    After reimport:
    upload_2023-4-24_15-28-2.png
     
  9. DSchroer-Unity

    DSchroer-Unity

    Unity Technologies

    Joined:
    May 19, 2021
    Posts:
    5
    Hey Spinaljack,

    Just wanted to let you know that we have identified the bug that you are experiencing. We will be working quickly to fix the issue as this is not intended behavior. We will let you know as soon as a fix is available.
     
    spinaljack likes this.
  10. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    Also I don't see a way to add parameters to the cloud code being uploaded and I have to manually add them in the dashboard. How do I add parameters from inside the editor?
     
  11. gpaquin-unity

    gpaquin-unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    33
    For this, you can declare directly within your script, following these guidelines: https://docs.unity.com/cloud-code/e...ripts-editor#Declare_parameters_in_the_script

    Make sure to initialize the JS Project first:

    In the Unity Editor, select Edit > Preferences… > Cloud Code > "Initialize JS Project"

    Referencing here the quick example in-script:
    Code (JavaScript):
    1.  
    2. module.exports = async ({ params, context, logger }) => {
    3.     return {
    4.         "value": params["aParam"]
    5.     };
    6. };
    7.  
    8. module.exports.params = { "aParam" : { "type": "String", "required": true } }
    9.  
     
  12. DSchroer-Unity

    DSchroer-Unity

    Unity Technologies

    Joined:
    May 19, 2021
    Posts:
    5
    Hey Spinaljack,

    I am happy to say that we have been able to find and fix the bug that you encountered. Thanks again for reporting this. If you update your packages:

    Deployment: 1.0.1
    Cloud Code: 2.3.2

    You should notice that the files are now always visible in the deployment window. Please give it a try and let us know if this works for you.
     
  13. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    Deploy window properly shows my files now
     
    GabKBelmonte and gpaquin-unity like this.
  14. AnAn1206

    AnAn1206

    Joined:
    Nov 19, 2018
    Posts:
    1
    This is great feature for cloud code!

    I hope there will be support for C# modules inside editor soon so that its can auto deploy to cloud code services without build and deploy with ugs CLI :D
     
  15. GabKBelmonte

    GabKBelmonte

    Unity Technologies

    Joined:
    Dec 14, 2021
    Posts:
    63