Method RemoveComponent
RemoveComponent(Entity, ComponentType)
Removes a component from an entity.
Declaration
public void RemoveComponent(Entity entity, ComponentType type)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity to modify. |
ComponentType | type |
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.
If componentType is a managed component which implements IDisposable, this operation will invoke Dispose() on the component value.
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.
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |