docs.unity3d.com
    Show / Hide Table of Contents

    Struct EntityCommandBuffer

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

    Namespace: Unity.Entities
    Syntax
    [NativeContainer]
    [BurstCompile]
    public struct EntityCommandBuffer : IDisposable

    Constructors

    Name Description
    EntityCommandBuffer(Allocator)

    Creates a new command buffer.

    EntityCommandBuffer(Allocator, PlaybackPolicy)

    Creates a new command buffer.

    Properties

    Name Description
    IsCreated
    IsEmpty
    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.

    Methods

    Name Description
    AddBuffer<T>(Entity)

    Records a command to add a dynamic buffer to an entity.

    AddComponent(NativeArray<Entity>, ComponentType)

    Records a command to add a component to a NativeArray of entities.

    AddComponent(NativeArray<Entity>, ComponentTypes)

    Records a command to add one or more components to a NativeArray of entities.

    AddComponent(Entity, ComponentType)

    Records a command to add a component to an entity.

    AddComponent(Entity, ComponentTypes)

    Records a command to add one or more components to an entity.

    AddComponent<T>(NativeArray<Entity>)

    Records a command to add component of type T to a NativeArray of entities.

    AddComponent<T>(NativeArray<Entity>, T)

    Records a command to add component of type T to a NativeArray of entities.

    AddComponent<T>(Entity)

    Records a command to add component of type T to an entity.

    AddComponent<T>(Entity, T)

    Records a command to add component of type T to an entity.

    AddComponentForEntityQuery(EntityQuery, ComponentType)

    Records a command to add a component to all entities matching a query.

    AddComponentForEntityQuery(EntityQuery, ComponentTypes)

    Records a command to add multiple components to all entities matching a query.

    AddComponentForEntityQuery<T>(EntityQuery)

    Records a command to add a component to all entities matching a query.

    AddComponentForEntityQuery<T>(EntityQuery, T)

    Records a command to add a component to all entities matching a query. Also sets the value of this new component on all the matching entities.

    AddComponentObjectForEntityQuery(EntityQuery, Object)

    Records a command to add a hybrid component and set its value for all entities matching a query.

    AddSharedComponent<T>(NativeArray<Entity>, T)

    Records a command to add a shared component value on a NativeArray of entities.

    AddSharedComponent<T>(Entity, T)

    Records a command to add a shared component value on an entity.

    AddSharedComponentForEntityQuery<T>(EntityQuery, T)

    Records a command to add a shared component to all entities matching a query.

    AppendToBuffer<T>(Entity, T)

    Records a command to append a single element to the end of a dynamic buffer component.

    AsParallelWriter()

    An extension of EntityCommandBuffer that allows concurrent (deterministic) command buffer recording.

    CreateEntity()

    Records a command to create an entity with no components.

    CreateEntity(EntityArchetype)

    Records a command to create an entity with specified archetype.

    DestroyEntitiesForEntityQuery(EntityQuery)

    Records a command to destroy all entities matching a query.

    DestroyEntity(NativeArray<Entity>)

    Records a command to destroy a NativeArray of entities.

    DestroyEntity(Entity)

    Records a command to destroy an entity.

    Dispose()
    Instantiate(Entity)

    Records a command to create an entity with specified entity prefab.

    Instantiate(Entity, NativeArray<Entity>)

    Records a command to create a NativeArray of entities with specified entity prefab.

    Playback(EntityManager)

    Play back all recorded operations against an entity manager.

    Playback(ExclusiveEntityTransaction)

    Play back all recorded operations with an exclusive entity transaction. BeginExclusiveEntityTransaction().

    RemoveComponent(NativeArray<Entity>, ComponentType)

    Records a command to remove one or more components from a NativeArray of entities.

    RemoveComponent(NativeArray<Entity>, ComponentTypes)

    Records a command to remove one or more components from a NativeArray of entities.

    RemoveComponent(Entity, ComponentType)

    Records a command to remove a component from an entity.

    RemoveComponent(Entity, ComponentTypes)

    Records a command to remove one or more components from an entity.

    RemoveComponent<T>(NativeArray<Entity>)

    Records a command to remove component of type T from a NativeArray of entities.

    RemoveComponent<T>(Entity)

    Records a command to remove component of type T from an entity.

    RemoveComponentForEntityQuery(EntityQuery, ComponentType)

    Records a command to remove a component from all entities matching a query.

    RemoveComponentForEntityQuery(EntityQuery, ComponentTypes)

    Records a command to remove multiple components from all entities matching a query.

    RemoveComponentForEntityQuery<T>(EntityQuery)

    Records a command to remove a component from all entities matching a query.

    SetBuffer<T>(Entity)

    Records a command to set a dynamic buffer on an entity.

    SetComponent<T>(Entity, T)

    Records a command to set a component value on an entity.

    SetComponentObjectForEntityQuery(EntityQuery, Object)

    Records a command to set a hybrid component value for all entities matching a query.

    SetName(Entity, in FixedString64Bytes)

    Records a command to set a name of an entity if Debug Names is enabled.

    SetSharedComponent<T>(NativeArray<Entity>, T)

    Records a command to set a shared component value on a NativeArray of entities.

    SetSharedComponent<T>(Entity, T)

    Records a command to set a shared component value on an entity.

    SetSharedComponentForEntityQuery<T>(EntityQuery, T)

    Records a command to set a shared component value on all entities matching a query.

    Extension Methods

    EntityCommandBufferManagedComponentExtensions.AddComponent<T>(EntityCommandBuffer, Entity, T)
    EntityCommandBufferManagedComponentExtensions.AddComponent<T>(EntityCommandBuffer, Entity)
    EntityCommandBufferManagedComponentExtensions.SetComponent<T>(EntityCommandBuffer, Entity, T)
    EntityCommandBufferManagedComponentExtensions.AddComponentForEntityQuery<T>(EntityCommandBuffer, EntityQuery, T)
    EntityCommandBufferManagedComponentExtensions.SetComponentForEntityQuery<T>(EntityCommandBuffer, EntityQuery, T)
    In This Article
    • Constructors
    • Properties
    • Methods
    • Extension Methods
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023