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

EntityCommandBuffer

struct in Unity.Entities

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

Description

A thread-safe command buffer that can buffer commands that affect entities and components for later playback.

Static Properties

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

Properties

Property Description
IsCreated Is true if the EntityCommandBuffer has been initialized correctly.
IsEmpty Returns true if the EntityCommandBuffer has not been initialized or no commands have been recorded.
MinimumChunkSize Allows controlling the size of chunks allocated from the temp job allocator to back the command buffer.
ShouldPlayback Controls whether this command buffer should play back.

Constructors

Constructor Description
EntityCommandBuffer Creates a new command buffer.

Public Methods

Method Description
AddBufferRecords a command to add a dynamic buffer to an entity.
AddComponent Records a command to add component of type T to an entity.
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.
AddSharedComponent Records a command to add a unmanaged shared component to all entities matching a query.
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 specified archetype.
DestroyEntityRecords a command to destroy an entity.
Dispose Deals with freeing and releasing unmanaged memory allocated by the entity command buffer.
InstantiateRecords a command to create an entity with specified entity prefab.
Playback Play back all recorded operations against an entity manager.
RemoveComponent Records a command to remove component of type T from an entity.
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.
SetComponent Records a command to set a component value on an entity.
SetComponentEnabled Records 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.
SetEnabled Records 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. If the entity was converted from a prefab and thus has a LinkedEntityGroup component, the entire group will be enabled or disabled.
SetName Records a command to set a name of an entity if Debug Names is enabled.
SetSharedComponent Records a command to set an unmanaged shared component value on all entities matching a query.