docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method RemoveComponent

    RemoveComponent<T>(int, 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
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    Entity e

    The entity to have the component removed.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    RemoveComponent<T>(int, 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
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    NativeArray<Entity> entities

    The NativeArray of entities to have the component removed.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    RemoveComponent(int, 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
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    Entity e

    The entity to have the component removed.

    ComponentType componentType

    The type of component to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    RemoveComponent(int, 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
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    NativeArray<Entity> entities

    The NativeArray of entities to have the component removed.

    ComponentType componentType

    The type of component to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    RemoveComponent(int, Entity, in ComponentTypeSet)

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

    Declaration
    public void RemoveComponent(int sortKey, Entity e, in ComponentTypeSet typeSet)
    Parameters
    Type Name Description
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    Entity e

    The entity to have the components removed.

    ComponentTypeSet typeSet

    The types of components to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    RemoveComponent(int, NativeArray<Entity>, in ComponentTypeSet)

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

    Declaration
    public void RemoveComponent(int sortKey, NativeArray<Entity> entities, in ComponentTypeSet typeSet)
    Parameters
    Type Name Description
    int sortKey

    A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128).

    NativeArray<Entity> entities

    The NativeArray of entities to have components removed.

    ComponentTypeSet typeSet

    The types of components to remove.

    Remarks

    At playback, it's 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 or Prefab.

    Exceptions
    Type Condition
    NullReferenceException

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

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)