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:
public static void PreExport(System.Action onComplete)
{
//Run coroutine then finally run onComplete()
}
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!
2 Likes
It looks like you can use Task.Run() to call async code as a synchronous. Task.Run Method (System.Threading.Tasks) | Microsoft Learn
Right, but would unity cloud wait for that to complete? EDIT: I see what you mean, that looks promising
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 ?
I’m not using Unity cloud anymore, but it does seem like it would work. Give it a try!
Hello,
You can use an Async method, to ensure that the next method is only started once the previous method has finished executing.
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.
1 Like