docs.unity.cn
    Show / Hide Table of Contents

    Method RemoveComponent

    RemoveComponent<T>(Entity)

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

    Declaration
    public void RemoveComponent<T>(Entity e)
    Parameters
    Type Name Description
    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    RemoveComponent<T>(NativeArray<Entity>)

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

    Declaration
    public void RemoveComponent<T>(NativeArray<Entity> entities)
    Parameters
    Type Name Description
    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    RemoveComponent(Entity, ComponentType)

    Records a command to remove a component from an entity.

    Declaration
    public void RemoveComponent(Entity e, ComponentType componentType)
    Parameters
    Type Name Description
    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    RemoveComponent(NativeArray<Entity>, ComponentType)

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

    Declaration
    public void RemoveComponent(NativeArray<Entity> entities, ComponentType componentType)
    Parameters
    Type Name Description
    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    RemoveComponent(Entity, ComponentTypes)

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

    Declaration
    public void RemoveComponent(Entity e, ComponentTypes componentTypes)
    Parameters
    Type Name Description
    Entity e

    The entity to have components removed.

    ComponentTypes componentTypes

    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    RemoveComponent(NativeArray<Entity>, ComponentTypes)

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

    Declaration
    public void RemoveComponent(NativeArray<Entity> entities, ComponentTypes componentTypes)
    Parameters
    Type Name Description
    NativeArray<Entity> entities

    The NativeArray of entities to have components removed.

    ComponentTypes componentTypes

    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.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

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