CombineDependencies
Combines multiple dependencies into a single dependency.
Read time 3 minutesLast updated 18 days ago
Definition
- Type: Method
- Namespace: Unity.Jobs
- Assembly: UnityEngine.CoreModule
CombineDependencies(JobHandle, JobHandle)
Combines multiple dependencies into a single dependency.
public static JobHandle CombineDependencies(JobHandle job0, JobHandle job1)
Parameters
Returns
Type | Description |
|---|---|
| JobHandle |
Remarks
All job schedule methods for IJob or IJobParallelFor job types take a single dependency. Sometimes you might need to express dependencies against multiple running jobs at the same time. Use this method to combine a set of dependencies into a single dependency that can be passed to a job.
Examples
// Schedule 3 jobs, jobs a and b can run in parallel to each other,// job c will only run once both jobA and jobB has completed// Schedule job avar jobA = new MyJob(...);var jobAHandle = jobA.Schedule();// Schedule job bvar jobB = new MyJob(...);var jobBHandle = jobB.Schedule();// For job c, combine dependencies of job a and b// Then use that for scheduling the next jobvar jobC = new DependentJob(...);var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle);jobC.Schedule(dependency);
CombineDependencies(JobHandle, JobHandle, JobHandle)
Combines multiple dependencies into a single dependency.
public static JobHandle CombineDependencies(JobHandle job0, JobHandle job1, JobHandle job2)
Parameters
Returns
Type | Description |
|---|---|
| JobHandle |
Remarks
All job schedule methods for IJob or IJobParallelFor job types take a single dependency. Sometimes you might need to express dependencies against multiple running jobs at the same time. Use this method to combine a set of dependencies into a single dependency that can be passed to a job.
Examples
// Schedule 3 jobs, jobs a and b can run in parallel to each other,// job c will only run once both jobA and jobB has completed// Schedule job avar jobA = new MyJob(...);var jobAHandle = jobA.Schedule();// Schedule job bvar jobB = new MyJob(...);var jobBHandle = jobB.Schedule();// For job c, combine dependencies of job a and b// Then use that for scheduling the next jobvar jobC = new DependentJob(...);var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle);jobC.Schedule(dependency);
CombineDependencies(NativeArray<JobHandle>)
Combines multiple dependencies into a single dependency.
public static JobHandle CombineDependencies(NativeArray<JobHandle> jobs)
Parameters
Returns
Type | Description |
|---|---|
| JobHandle |
Remarks
All job schedule methods for IJob or IJobParallelFor job types take a single dependency. Sometimes you might need to express dependencies against multiple running jobs at the same time. Use this method to combine a set of dependencies into a single dependency that can be passed to a job.
Examples
// Schedule 3 jobs, jobs a and b can run in parallel to each other,// job c will only run once both jobA and jobB has completed// Schedule job avar jobA = new MyJob(...);var jobAHandle = jobA.Schedule();// Schedule job bvar jobB = new MyJob(...);var jobBHandle = jobB.Schedule();// For job c, combine dependencies of job a and b// Then use that for scheduling the next jobvar jobC = new DependentJob(...);var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle);jobC.Schedule(dependency);
CombineDependencies(NativeSlice<JobHandle>)
Combines multiple dependencies into a single dependency.
public static JobHandle CombineDependencies(NativeSlice<JobHandle> jobs)
Parameters
Returns
Type | Description |
|---|---|
| JobHandle |
Remarks
All job schedule methods for IJob or IJobParallelFor job types take a single dependency. Sometimes you might need to express dependencies against multiple running jobs at the same time. Use this method to combine a set of dependencies into a single dependency that can be passed to a job.
Examples
// Schedule 3 jobs, jobs a and b can run in parallel to each other,// job c will only run once both jobA and jobB has completed// Schedule job avar jobA = new MyJob(...);var jobAHandle = jobA.Schedule();// Schedule job bvar jobB = new MyJob(...);var jobBHandle = jobB.Schedule();// For job c, combine dependencies of job a and b// Then use that for scheduling the next jobvar jobC = new DependentJob(...);var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle);jobC.Schedule(dependency);