Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityManager.RemoveComponent

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void RemoveComponent(NativeArray<Entity> entities, ref ComponentTypeSet componentTypeSet);

Parameters

Parameter Description
entities The collection of entities to modify.
componentTypeSet The types of components to remove.

Description

Removes multiple components from a specified colleciton of entities.

You can use this method to remove a component from an Entity

It's OK if some or all of the components to remove are already missing from the entity.

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

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


Declaration

public void RemoveComponent(NativeArray<Entity> entities, ComponentType componentType);

Parameters

Parameter Description
entities An array of Entity objects.
componentType The type of component to remove.

Description

Remove a component from a set of entities.

Can remove any kind of component.

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

Important: This method creates a sync point, which means that the EntityManager waits for all currently running jobs to complete before creating the chunk. No additional jobs can start before the method is finished. A sync point can cause a drop in performance because the ECS framework might not be able to use the processing power of all available cores.


Declaration

public bool RemoveComponent(Entity entity, ComponentType componentType);

Parameters

Parameter Description
entity The entity to modify.
componentType The type of component to remove.

Returns

bool True if the component was removed successfully.

Description

Removes a component from an entity.

Can remove any kind of component.

Returns false if the entity already does not have the specified component, or if the entity does not exist.

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

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


Declaration

public bool RemoveComponent(SystemHandle system, ComponentType componentType);

Parameters

Parameter Description
system The system handle.
componentType The type of component to remove.

Returns

bool True if the component was removed successfully.

Description

Removes a component from an entity associated with a system.

Can remove any kind of component.

Returns false if the entity already does not have the specified component, or if the entity does not exist.

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

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


Declaration

public void RemoveComponent(Entity entity, ref ComponentTypeSet componentTypeSet);

Parameters

Parameter Description
entity The entity to modify.
componentTypeSet The types of components to remove.

Description

Removes multiple components from an entity.

You can use this method to remove a component from an Entity

It's OK if some or all of the components to remove are already missing from the entity, or if the target entity does not exist.

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

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


Declaration

public void RemoveComponent(EntityQuery entityQuery, ComponentType componentType);

Parameters

Parameter Description
entityQuery The EntityQuery defining the entities to modify.
componentType The type of component to remove.

Description

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

Can remove any kind of component.

It's OK if some or all of the components to remove are already missing from some or all of the entities.

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

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


Declaration

public void RemoveComponent(EntityQuery entityQuery, ref ComponentTypeSet componentTypeSet);

Parameters

Parameter Description
entityQuery The EntityQuery defining the entities to modify.
componentTypeSet The types of components to add.

Description

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

You can use this method to remove a component from an Entity

It's OK if some or all of the components to remove are already missing from some or all of the entities.

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

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


Declaration

public bool RemoveComponent(Entity entity);

Parameters

Parameter Description
entity The entity.

Returns

bool True if the component was removed successfully.

Description

Removes a component from an entity.

Can remove any kind of component except chunk components.

Returns false if the entity was already missing the component.

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

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


Declaration

public bool RemoveComponent(SystemHandle system);

Parameters

Parameter Description
system The system handle.

Returns

bool True if the component was removed successfully.

Description

Removes a component from an entity associated with a system.

Can remove any kind of component except chunk components.

Returns false if the entity was already missing the component.

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

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


Declaration

public void RemoveComponent(EntityQuery entityQuery);

Parameters

Parameter Description
entityQuery The EntityQuery defining the entities to modify.

Description

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

Can remove any kind of component except chunk components.

It's OK if the component to remove is already missing from some or all of the entities.

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

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


Declaration

public void RemoveComponent(NativeArray<Entity> entities);

Parameters

Parameter Description
entities An array identifying the entities to modify.

Description

Removes a component from a set of entities.

Can remove any kind of component except chunk components.

It's OK if the component to remove is already missing from some or all of the entities.

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

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