I am investigating DOTS and I am looking for confirmation that I understood this part correctly.
when I call .Schedule() on a job it gets added to the queue.
but only when I call handle.Complete() the Job System may start execution.
so given:
10 j = new MyJob{…}
11 JobHandle h = j.Schedule();
12 h.Complete()
13 //use Data from job
all the job-work is guaranteed to happen between line 12 and 13.
Complete() waits for the job to finish and only after that, line 13 gets executed
so if I would write:
h.Complete()
h1.Complete()
h2.Complete()
that would be very inefficient because each line would wait until its job returned done.
so to handle this, use:
JobHandle.CompleteAll(h, h1, h2)
to let the jobSystem optimize the order and use all cores
IJobParallelFor()
to let the Job System split one job to all available cores.
Is this correct?
Any help and further information is very much appreciated!