Class JobDependencyTracker Extends IAstarPooledObject

Public

Automatic dependency tracking for the Unity Job System.

Uses reflection to find the [ReadOnly] and [WriteOnly] attributes on job data struct fields. These are used to automatically figure out dependencies between jobs.

A job that reads from an array depends on the last job that wrote to that array. A job that writes to an array depends on the last job that wrote to the array as well as all jobs that read from the array.

struct ExampleJob : IJob {
public NativeArray<int> someData;

public void Execute () {
// Do something
}
}

void Start () {
var tracker = new JobDependencyTracker();
var data = new NativeArray<int>(100, Allocator.TempJob);
var job1 = new ExampleJob {
someData = data
}.Schedule(tracker);

var job2 = new ExampleJob {
someData = data
}.Schedule(tracker);

// job2 automatically depends on job1 because they both require read/write access to the data array
}

Inner Types

Public Methods

ClearMemory ()
Public
DeferFree (handle, dependsOn)

Frees the GCHandle when the JobDependencyTracker is disposed.

Public
NewNativeArray<T> (length, allocator, options=…)
Public
Persist<T> (array)

Makes the given array not be disposed when this tracker is disposed.

Public
ScheduleBatch (commands, results, minCommandsPerJob)

Schedules a raycast batch command.

Public
ScheduleBatch (commands, results, minCommandsPerJob)

Schedules an overlap capsule batch command.

Public
ScheduleBatch (commands, results, minCommandsPerJob)

Schedules an overlap sphere batch command.

Public
SetLinearDependencies (linearDependencies)

Disable dependency tracking and just run jobs one after the other.

Public
Track<T> (array, initialized=true)
Public

Public Variables

AllWritesDependency

JobHandle that represents a dependency for all jobs.

Public
forceLinearDependencies
Public

Private/Protected Members

Dispose ()

Disposes this tracker.

Private
JobReadsFrom (job, nativeArrayHash, jobHash)
Internal
JobWritesTo (job, nativeArrayHash, jobHash)
Internal
OnEnterPool ()
Private
arena
Private
dependenciesScratchBuffer
Internal
linearDependencies
Private
slots
Internal
supportsMultithreading
Private
timeSlice
Internal