I am trying to make coroutine that waits for Job to complete and then run some code, now I use yield return new WaitUntil((() => dependsOn.IsCompleted));
The thing is coroutine runs only once a frame and need to wait to execute code in next frame even though job is completed much faster. How can I make coroutine run twice a frame(or more) to make it faster? If I can’t then is there any other way to execute code on job completion?
Here’s the Unity timing diagram:
You can’t really meaningfully get more than one call on a coroutine per frame. I mean you can certainly do something twice in a coroutine in one frame, but they will occur immediately after each other, not spread out evenly.
Perhaps there is a job callback you can attach? I haven’t used the job system, but look if there is an event you can attach to for OnComplete or Completed or something like that.