Version: Unity 6.1 Alpha (6000.1)
LanguageEnglish
  • C#

IJobParallelForTransformExtensions.RunReadOnlyByRef

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 void RunReadOnlyByRef(ref T jobData, Jobs.TransformAccessArray transforms);

Parameters

transforms The TransformAccessArray to run this job on.
jobData The job to run.

Description

Runs an IJobParallelForTransform job immediately on the main thread, with read-only access to the transform data.

While this method is useful in development or test environments, it is typically a mistake to use it in production; it offers no real benefits over implementing the job code as a simple main-thread function call. To schedule a job to run asynchronously, use IJobParallelForTransformExtensions.ScheduleReadOnlyByRef.

This method assumes the job only requires read-only access to the transform data, and skips any sorting or filtering of the input transforms which would otherwise be necessary for safety purposes. One important consequence is that any null, deleted, or invalid Transforms in the input TransformAccessArray will not be filtered out, and are still passed to worker threads for processing. Jobs that use this scheduling mode should therefore use TransformAccess.isValid to check whether a specific transform instance is valid before processing its data.

This variant passes the job struct by reference instead of by value, which can be faster than IJobParallelForTransformExtensions.RunReadOnly for larger job structs. Note that worker threads always operate on a local copy of the job struct.