docs.unity3d.com
    Show / Hide Table of Contents

    Method RemoveComponent

    RemoveComponent(NativeArray<Entity>, ComponentType)

    Remove a component from a set of entities.

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

    An array of Entity objects.

    ComponentType componentType

    The type of component to remove.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    If an Entity object in the entities array refers to an entity that has been destroyed, this function throws an ArgumentError exception.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before creating these chunks and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent(Entity, ComponentType)

    Removes a component from an entity. Returns false if the entity did not have the component.

    Declaration
    public bool RemoveComponent(Entity entity, ComponentType componentType)
    Parameters
    Type Name Description
    Entity entity

    The entity to modify.

    ComponentType componentType

    The type of component to remove.

    Returns
    Type Description
    Boolean
    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent(Entity, ComponentTypes)

    Removes multiple components from an entity.

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

    The entity to modify.

    ComponentTypes componentTypes

    The types of components to remove.

    Remarks

    If the entity has none of the specified components, the call will do nothing.

    Removing components changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent(EntityQuery, ComponentType)

    Removes a component from a set of entities defined by a EntityQuery.

    Declaration
    public void RemoveComponent(EntityQuery entityQuery, ComponentType componentType)
    Parameters
    Type Name Description
    EntityQuery entityQuery

    The EntityQuery defining the entities to modify.

    ComponentType componentType

    The type of component to remove.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent(EntityQuery, ComponentTypes)

    Removes a set of components from a set of entities defined by a EntityQuery.

    Declaration
    public void RemoveComponent(EntityQuery entityQuery, ComponentTypes types)
    Parameters
    Type Name Description
    EntityQuery entityQuery

    The EntityQuery defining the entities to modify.

    ComponentTypes types

    The types of components to add.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent<T>(Entity)

    Removes a component from an entity. Returns false if the entity did not have the component.

    Declaration
    public bool RemoveComponent<T>(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The entity.

    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent<T>(EntityQuery)

    Removes a component from a set of entities defined by a EntityQuery.

    Declaration
    public void RemoveComponent<T>(EntityQuery entityQuery)
    Parameters
    Type Name Description
    EntityQuery entityQuery

    The EntityQuery defining the entities to modify.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    RemoveComponent<T>(NativeArray<Entity>)

    Removes a component from a set of entities.

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

    An array identifying the entities to modify.

    Type Parameters
    Name Description
    T

    The type of component to remove.

    Remarks

    Removing a component changes an entity's archetype and results in the entity being moved to a different chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before removing the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    Back to top
    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