| Parameter | Description |
|---|---|
| producerJob | The JobHandle of a Job which this buffer system should wait for before playing back its pending command buffers. |
Adds the specified JobHandle to this system's list of dependencies.
When you write to an EntityCommandBuffer that you created with EntityCommandBufferSystem.CreateCommandBuffer from a
job, you must add the JobHandle of that job to this EntityCommandBufferSystem input
dependencies by calling this function. Otherwise, this system could attempt to execute the command buffer contents
while the writing job is still running, causing a race condition.
Don't call this function for command buffers that you created through the buffer system's Singleton component.
Those command buffers are tracked through the singleton component itself, and this system completes all jobs
scheduled against that component before it plays the command buffers back.
The following example illustrates how to use one of the default <see cref="Unity.Entities.EntityCommandBufferSystem" />s.
The code selects all entities that have one custom component, in this case, AsyncProcessInfo, and
processes each entity in the Execute() function of an <see cref="Unity.Entities.IJobEntity" /> Job. After processing, the Job
uses a <see cref="Unity.Entities.EntityCommandBuffer" /> to remove the ProcessInfo component and add a ProcessCompleteTag
component. Another system could use the ProcessCompleteTag to find entities that represent the end
results of the process.