A job is a small unit of work that does one specific task. A job receives parameters and operates on data, similar to how a method call behaves. Jobs can be self-contained, or they can depend on other jobs to complete before they can run. In Unity, a job refers to any struct that implements the IJob
interface.
Only the main thread can schedule and complete jobs. It can’t access the content of any running jobs, and two jobs can’t access the contents of a job at the same time. To ensure efficient running of jobs, you can make them dependent on each other. Unity’s job system allows you to create complex dependency chains to ensure that your jobs complete in the correct order.
IJobParallelFor
, but allows you to schedule the job so that it doesn’t run in parallel.