Function IJobExtensions.ExecuteMainThreadJob

ExecuteMainThreadJob<T> (this T data, JobDependencyTracker tracker)

Executes this job in the main thread using a coroutine.

Public Static
IEnumerator<JobHandle> ExecuteMainThreadJob<T> (

this T

data

JobDependencyTracker

tracker

)

Executes this job in the main thread using a coroutine.

Usage:

  • 1. Optionally schedule some other jobs before this one (using the dependency tracker)

  • 2. Call job.ExecuteMainThreadJob(tracker)

  • 3. Iterate over the enumerator until it is finished. Call handle.Complete on all yielded job handles. Usually this only yields once, but if you use the JobHandleWithMainThreadWork wrapper it will yield once for every time slice.

  • 4. Continue scheduling other jobs.

You must not schedule other jobs (that may touch the same data) while executing this job.