Version: 2023.2
언어: 한국어

JobHandle.CombineDependencies

매뉴얼로 전환
public static Unity.Jobs.JobHandle CombineDependencies (Unity.Jobs.JobHandle job0, Unity.Jobs.JobHandle job1);
public static Unity.Jobs.JobHandle CombineDependencies (Unity.Jobs.JobHandle job0, Unity.Jobs.JobHandle job1, Unity.Jobs.JobHandle job2);
public static Unity.Jobs.JobHandle CombineDependencies (NativeArray<JobHandle> jobs);
public static Unity.Jobs.JobHandle CombineDependencies (NativeSlice<JobHandle> jobs);

설명

Combines multiple dependencies into a single one.

All job schedule functions for example IJob or IJobParallelFor take a single dependency, sometimes it is necessary to express dependencies against multiple running jobs at the same time. So you can use this function to combine a set of dependencies into a single dependency that can be passed to a job.

// 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 a var jobA = new MyJob(...); var jobAHandle = jobA.Schedule();

// Schedule job b var jobB = new MyJob(...); var jobBHandle = jobB.Schedule();

// For job c, combine dependencies of job a and b // Then use that for scheduling the next job var jobC = new DependentJob(...); var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle); jobC.Schedule(dependency);