what does JobHandle.CombineDependencies do in Boids example ?

I want to ask some question about the boid example because the lake of documentation :

  • what JobHandle.CombineDependencies do and when to use it ?
  • why did we pass JobHandle to ComponentGroup as in :
    m_BoidGroup.AddDependency(inputDeps); in BoidSystem.cs

JobHandle.CombineDependencies allows you to combine multiple job handles into a single dependency. For example if you create 5 parallel jobs and you want to wait until all of them are finished you can call JobHandle.CombineDependencies giving it the 5 job handles from your jobs and you receive a single job handle. Waiting on this handle will ensure that all 5 jobs are completed before continuing.

As for adding a job handle to a ComponentGroup i have no solid idea what this is good for and why one would do it. Maybe someone from Unity can shed light on this.

1 Like