Namespace Unity.Jobs | Jobs | 0.2.10-preview.12
docs.unity3d.com
    Show / Hide Table of Contents

    Namespace Unity.Jobs

    Classes

    AutoCreateReflectionDataAttribute

    IJobBurstScheduableExtensions

    IJobParallelForBatchExtensions

    IJobParallelForDeferExtensions

    IJobParallelForExtensionsBurstScheduable

    JobParallelIndexListExtensions

    Interfaces

    IJobBurstScheduable

    IJobParallelForBatch

    IJobParallelForBurstScheduable

    IJobParallelForDefer

    A replacement for IJobParallelFor when the number of work items is not known at Schedule time. IJobParallelForDefer lets you calculate the number of iterations to perform in a job that must execute before the IJobParallelForDefer job.

    When Scheduling the job's Execute(int index) method will be invoked on multiple worker threads in parallel to each other. Execute(int index) will be executed once for each index from 0 to the provided length. Each iteration must be independent from other iterations (The safety system enforces this rule for you). The indices have no guaranteed order and are executed on multiple cores in parallel. Unity automatically splits the work into chunks of no less than the provided batchSize, and schedules an appropriate number of jobs based on the number of worker threads, the length of the array and the batch size. Batch size should generally be chosen depending on the amount of work performed in the job. A simple job, for example adding a couple of float3 to each other should probably have a batch size of 32 to 128. However if the work performed is very expensive then it is best to use a small batch size, for expensive work a batch size of 1 is totally fine. IJobParallelFor performs work stealing using atomic operations. Batch sizes can be small but they are not for free. The returned JobHandle can be used to ensure that the job has completed. Or it can be passed to other jobs as a dependency, thus ensuring the jobs are executed one after another on the worker threads.

    IJobParallelForFilter

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023