docs.unity.cn
    Show / Hide Table of Contents

    Method RemoveComponent

    RemoveComponent<T>(Int32, Entity)

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

    Declaration
    public void RemoveComponent<T>(int sortKey, Entity e)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    Entity e

    The entity to have the component removed.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    Behavior at Playback: It is not an error if the entity doesn't have component T. Will throw an error if this entity is destroyed before playback, if this entity is still deferred, or if T is type Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    RemoveComponent<T>(Int32, NativeArray<Entity>)

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

    Declaration
    public void RemoveComponent<T>(int sortKey, NativeArray<Entity> entities)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    NativeArray<Entity> entities

    The NativeArray of entities to have the component removed.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    Behavior at Playback: It is not an error if any entity doesn't have component T. Will throw an error if one of these entities is destroyed before playback, if one of these entities is still deferred, or if T is type Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    RemoveComponent(Int32, Entity, ComponentType)

    Records a command to remove a component from an entity.

    Declaration
    public void RemoveComponent(int sortKey, Entity e, ComponentType componentType)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    Entity e

    The entity to have the component removed.

    ComponentType componentType

    The type of component to remove.

    Remarks

    Behavior at Playback: It is not an error if the entity doesn't have the component type. Will throw an error if this entity is destroyed before playback, if this entity is still deferred, or if the component type is Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    RemoveComponent(Int32, NativeArray<Entity>, ComponentType)

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

    Declaration
    public void RemoveComponent(int sortKey, NativeArray<Entity> entities, ComponentType componentType)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    NativeArray<Entity> entities

    The NativeArray of entities to have the component removed.

    ComponentType componentType

    The type of component to remove.

    Remarks

    Behavior at Playback: It is not an error if any entity doesn't have the component type. Will throw an error if one of these entities is destroyed before playback, if one of these entities is still deferred, or if the component type is Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    RemoveComponent(Int32, Entity, ComponentTypes)

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

    Declaration
    public void RemoveComponent(int sortKey, Entity e, ComponentTypes types)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    Entity e

    The entity to have the components removed.

    ComponentTypes types

    The types of components to remove.

    Remarks

    Behavior at Playback: It is not an error if the entity doesn't have one of the component types. Will throw an error if this entity is destroyed before playback, if this entity is still deferred, or if any of the component types are Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    RemoveComponent(Int32, NativeArray<Entity>, ComponentTypes)

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

    Declaration
    public void RemoveComponent(int sortKey, NativeArray<Entity> entities, ComponentTypes types)
    Parameters
    Type Name Description
    Int32 sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The entityInQueryIndex argument provided by Entities is an appropriate value to use for this parameter. In an IJobEntityBatch pass the 'batchIndex' value from Execute(ArchetypeChunk, Int32).

    NativeArray<Entity> entities

    The NativeArray of entities to have components removed.

    ComponentTypes types

    The types of components to remove.

    Remarks

    Behavior at Playback: It is not an error if any entity doesn't have one of the component types. Will throw an error if one of these entities is destroyed before playback, if one of these entities is still deferred, or if any of the component types are Entity.

    Exceptions
    Type Condition
    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Wednesday, July 6, 2022
    Terms of use