Documentation

Unity Engine


Unity Engine


EntityCommandBuffer

A thread-safe command buffer that can buffer commands that affect entities and components for later playback.
Read time 3 minutesLast updated a day ago

Definition

[BurstCompile]public struct EntityCommandBuffer : IDisposable

Constructors

Constructor

Description

EntityCommandBuffer(Unity.Collections.AllocatorManager.AllocatorHandle)Creates a new command buffer.

Properties

Property

Description

IsCreatedIs true if the EntityCommandBuffer has been initialized correctly.
IsEmptyReturns true if the EntityCommandBuffer has not been initialized or no commands have been recorded.
MinimumChunkSizeAllows controlling the size of chunks allocated from the temp job allocator to back the command buffer.
ShouldPlaybackControls whether this command buffer should play back.

Static Properties

Property

Description

PLAYBACK_WITH_TRACEA static field for logging details during EntityCommandBuffer playback. When set to true, each EntityCommandBuffer will log its commands as they are processed during playback.

Methods

Method

Description

AddBufferRecords a command to add a dynamic buffer to an entity.
AddComponentRecords a command to add a component to a NativeArray of entities.
AddComponentForLinkedEntityGroupRecords a command that adds a component to an entity's LinkedEntityGroup based on an EntityQueryMask. Entities in the LinkedEntityGroup that don't match the mask will be skipped safely.
AddSharedComponentRecords a command to add an unmanaged shared component value on a NativeArray of entities.
AppendToBufferRecords a command to append a single element to the end of a dynamic buffer component.
AsParallelWriterAn extension of EntityCommandBuffer that allows concurrent (deterministic) command buffer recording.
CreateEntityRecords a command to create an entity with no components.
DestroyEntityRecords a command to destroy a NativeArray of entities.
DisposeDeals with freeing and releasing unmanaged memory allocated by the entity command buffer.
InstantiateRecords a command to create an entity with specified entity prefab.
PlaybackPlay back all recorded operations against an entity manager.
RemoveComponentRecords a command to remove one or more components from a NativeArray of entities.
ReplaceComponentForLinkedEntityGroupRecords a command that replaces a component value for an entity's LinkedEntityGroup. Entities in the LinkedEntityGroup that don't have the component will be skipped safely.
SetBufferRecords a command to set a dynamic buffer on an entity.
SetComponentRecords a command to set a component value on an entity.
SetComponentEnabledRecords a command to enable or disable a ComponentType on the specified Entity. This operation does not cause a structural change, or affect the value of the component. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
SetComponentForLinkedEntityGroupRecords a command that sets a component for an entity's LinkedEntityGroup based on an EntityQueryMask. Entities in the LinkedEntityGroup that don't match the mask will be skipped safely.
SetEnabledRecords a command to add or remove the Disabled component. By default EntityQuery does not include entities containing the Disabled component. Enabled entities are processed by systems, disabled entities are not.
SetNameRecords a command to set a name of an entity if Debug Names is enabled.
SetSharedComponentRecords a command to set an unmanaged shared component value on a NativeArray of entities.

Structs

Struct

Description

EntityCommandBuffer.ParallelWriterAllows concurrent (deterministic) command buffer recording.