Search Unity

Feedback Cloud Build - Pre-Export Method: Allow Async

Discussion in 'Unity Build Automation' started by joshcamas, Aug 8, 2020.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    Hello!

    I'm working on getting some tools integrated into Cloud Build by using the Pre-Export Method.
    It'd be REALLY nice if there was a form of the Pre-Export Method that would provide an action to be called once the method is completed. IE:

    Code (CSharp):
    1. public static void PreExport(System.Action onComplete)
    2. {
    3. //Run coroutine then finally run onComplete()
    4. }
    This would allow any non-asynchronous generation tools to work right out of the box! For example, I do not include a lot of generated data (lighting data, navigation data, etc) on my repo - instead, I have tools that automatically batch all needed data on the developers side. I'd of course need to be able to run these tools on the cloud build side as well!
     
    Skibitsky and LaviK47 like this.
  2. seagulluax

    seagulluax

    Joined:
    Oct 2, 2016
    Posts:
    4
  3. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    Right, but would unity cloud wait for that to complete? EDIT: I see what you mean, that looks promising
     
  4. cjlazar-kumu

    cjlazar-kumu

    Joined:
    Apr 18, 2022
    Posts:
    2
    I was looking into this too. Did you have any luck using Task.Run() (and presumably Task.Wait()) to run async code in the pre/post export methods and have it play nicely with Cloud Build @joshcamas ?
     
  5. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    I'm not using Unity cloud anymore, but it does seem like it would work. Give it a try!
     
  6. Carl_UnityDSE

    Carl_UnityDSE

    Unity Technologies

    Joined:
    May 25, 2022
    Posts:
    59
    Hello,
    You can use an Async method, to ensure that the next method is only started once the previous method has finished executing.
     
  7. abhi3188

    abhi3188

    Joined:
    Dec 13, 2015
    Posts:
    31
    Doesn't unity cloud build doc explicitly say you need to use a void function? How would you use an async method with Task?

    I tried an async method with void and it did not wait for completion before starting the next method.
     
    berkantalkn likes this.