Giving a Job a certain amount of time to complete

I’m a little confused on how to go about giving a job some time to complete, rather than forcing it to complete the same frame that I scheduled it. Them documentation (https://docs.unity3d.com/Manual/JobSystemSchedulingJobs.html) shows the scheduling happening in the same frame as the completion:

// Schedule the job
JobHandle handle = jobData.Schedule();

// Wait for the job to complete
handle.Complete();

But what if I want to give the job more time? In my case, it would be convenient to allow a job to run between FixedUpdate calls, to prepare some data for the next FixedUpdate. The FixedUpdate logic would ideally be something like this:

  • Complete the job, if one is running
  • Act on any previously computed job data
  • Schedule a new job to prepare data for the next Fixed Update.

Would this be as simple as calling .Schedule on my job handle at the end of the FixedUpdate, and calling Complete on the job handle at the beginning of the FixedUpdate? Is it okay to keep the job handle on a private class variable, and Schedule and Complete it across different frames?

Yes you can complete job in any other frame.