Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityCommandBufferSystem.CreateCommandBuffer

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 EntityCommandBuffer CreateCommandBuffer();

Returns

EntityCommandBuffer A command buffer that will be executed by this system.

Description

Creates an EntityCommandBuffer and adds it to this system's list of command buffers.

This buffer system executes its list of command buffers during its EntityCommandBufferSystem.OnUpdate function in the order you created the command buffers.

This method requires a managed reference to the buffer system. To create a command buffer from unmanaged systems code, get the buffer system's Singleton component with SystemAPI.GetSingleton and call CreateCommandBuffer(WorldUnmanaged) on that singleton instead.

If you write to a command buffer created by this method in a job, you must add the job as a dependency of this system by calling EntityCommandBufferSystem.AddJobHandleForProducer. The dependency ensures that the buffer system waits for the job to complete before executing the command buffer. This step isn't necessary for command buffers created through the buffer system's Singleton component, because the buffer system completes all jobs scheduled against that singleton component before it plays the command buffer back.

If you write to a command buffer from a parallel Job, such as IJobEntity or IJobChunk, you must use the concurrent version of the command buffer, provided by ParallelWriter.


Declaration

public static EntityCommandBuffer CreateCommandBuffer(ref UnsafeList`1 pendingBuffers, AllocatorHandle allocator, WorldUnmanaged world);

Parameters

Parameter Description
pendingBuffers The list of command buffers to append to
allocator The allocator to allocate from, when building the command buffer
world The world that this command buffer buffers changes for

Returns

EntityCommandBuffer Returns the command buffer

Description

Creates a command buffer, sets it up, and appends it to a list of command buffers.


Declaration

public static EntityCommandBuffer CreateCommandBuffer(ref UnsafeList`1 pendingBuffers, WorldUnmanaged world);

Parameters

Parameter Description
pendingBuffers The list of command buffers to append to
world The world that this command buffer buffers changes for

Returns

EntityCommandBuffer Returns the command buffer

Description

Creates a command buffer that allocates from a World's Update Allocator, sets it up, and appends it to a list of command buffers.