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
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 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.
Exceptions
Type | Condition |
---|---|
ArgumentException | The |
RemoveComponent(Entity, ComponentType)
Removes a component from an entity.
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
Can remove any kind of component.
Returns false if the entity already does not have the specified component.
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.
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |
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
Can remove any kinds of components.
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 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.
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |
RemoveComponent(EntityQuery, ComponentType)
Removes a component from a set of entities defined by an 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
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 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 an 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
Can remove any kinds of components.
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 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.
Declaration
[BurstCompatible(GenericTypeArguments = new Type[]{typeof(BurstCompatibleComponentData)})]
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
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 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.
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |
RemoveComponent<T>(EntityQuery)
Removes a component from a set of entities defined by a EntityQuery.
Declaration
[BurstCompatible(GenericTypeArguments = new Type[]{typeof(BurstCompatibleComponentData)})]
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
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 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
[BurstCompatible(GenericTypeArguments = new Type[]{typeof(BurstCompatibleComponentData)})]
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
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 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.