RemoveComponent
Removes multiple components from a specified colleciton of entities.
Read time 8 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
RemoveComponent(NativeArray<Entity>, ComponentTypeSet)
Removes multiple components from a specified colleciton of entities.
public void RemoveComponent(NativeArray<Entity> entities, in ComponentTypeSet componentTypeSet)
Parameters
The collection of entities to modify.
The types of components to remove.
Remarks
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.
RemoveComponent(NativeArray<Entity>, ComponentType)
Remove a component from a set of entities.
public void RemoveComponent(NativeArray<Entity> entities, ComponentType componentType)
Parameters
An array of Entity objects.
The type of component to remove.
Remarks
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.
RemoveComponent(Entity, ComponentType)
Removes a component from an entity.
public bool RemoveComponent(Entity entity, ComponentType componentType)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the component was removed successfully. |
Remarks
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.
RemoveComponent(SystemHandle, ComponentType)
Removes a component from an entity associated with a system.
public bool RemoveComponent(SystemHandle system, ComponentType componentType)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the component was removed successfully. |
Remarks
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.
RemoveComponent(Entity, ComponentTypeSet)
Removes multiple components from an entity.
public void RemoveComponent(Entity entity, in ComponentTypeSet componentTypeSet)
Parameters
Remarks
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.
RemoveComponent(EntityQuery, ComponentType)
Removes a component from a set of entities defined by an EntityQuery.
public void RemoveComponent(EntityQuery entityQuery, ComponentType componentType)
Parameters
The EntityQuery defining the entities to modify.
The type of component to remove.
Remarks
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.
RemoveComponent(EntityQuery, ComponentTypeSet)
Removes a set of components from a set of entities defined by an EntityQuery.
public void RemoveComponent(EntityQuery entityQuery, in ComponentTypeSet componentTypeSet)
Parameters
The EntityQuery defining the entities to modify.
The types of components to add.
Remarks
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.
RemoveComponent<T>(Entity)
Removes a component from an entity.
public bool RemoveComponent<T>(Entity entity)
Parameters
The entity.
Returns
Type | Description |
|---|---|
| bool | True if the component was removed successfully. |
Remarks
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.
RemoveComponent<T>(SystemHandle)
Removes a component from an entity associated with a system.
public bool RemoveComponent<T>(SystemHandle system)
Parameters
The system handle.
Returns
Type | Description |
|---|---|
| bool | True if the component was removed successfully. |
Remarks
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.
RemoveComponent<T>(EntityQuery)
Removes a component from a set of entities defined by a EntityQuery.
public void RemoveComponent<T>(EntityQuery entityQuery)
Parameters
The EntityQuery defining the entities to modify.
Remarks
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.
RemoveComponent<T>(NativeArray<Entity>)
Removes a component from a set of entities.
public void RemoveComponent<T>(NativeArray<Entity> entities)
Parameters
An array identifying the entities to modify.
Remarks
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.