Version: 2021.1
LanguageEnglish
  • C#

JobHandle.CombineDependencies

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static Unity.Jobs.JobHandle CombineDependencies(Unity.Jobs.JobHandle job0, Unity.Jobs.JobHandle job1);

Declaration

public static Unity.Jobs.JobHandle CombineDependencies(Unity.Jobs.JobHandle job0, Unity.Jobs.JobHandle job1, Unity.Jobs.JobHandle job2);

Declaration

public static Unity.Jobs.JobHandle CombineDependencies(NativeArray<JobHandle> jobs);

Declaration

public static Unity.Jobs.JobHandle CombineDependencies(NativeSlice<JobHandle> jobs);

Description

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, job a and be 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);
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961