Does scheduling multiple jobs in OnUpdate, maintains execution order?

Does scheduling multiple chained jobs in OnUpdate, maintains execution order?

So for example I have

protected override JobHandle OnUpdate ( JobHandle inputDeps )
        {        
  var job1 = new Job1 {
  // ... some job2 data
  }.Schedule (inputDeps) ;

  var job2 = new Job2 {
  // .. some job2 data
  }.Schedule (job1) ;

  return job2 ;
}

My both jobs are simple IJob in this case.
Will Job1 be executed before Job2, or this is not guaranteed?

That’s the whole point of passing the handle from job1 to job2.

If you did something like this

protected override JobHandle OnUpdate ( JobHandle inputDeps )
        {      
  var job1 = default(Job1).Schedule (inputDeps);
  var job2 = default(Job2).Schedule (inputDeps);
  return JobHandle.CombineDependencies(job1, job2);
}

Then they’d run simultaneously.

1 Like

Thanks.
Just simply could find a way, to confirm this, by testing.