Method RemoveComponentForEntityQuery
RemoveComponentForEntityQuery(EntityQuery, ComponentType)
Records a command to remove a component from all entities matching a query.
Declaration
public void RemoveComponentForEntityQuery(EntityQuery entityQuery, ComponentType componentType)
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | entityQuery | The query specifying the entities from which the component is removed. |
ComponentType | componentType | The types of component to remove. |
Remarks
The set of entities matching the query is 'captured' in the method call, and the recorded command stores an array of all these entities.
Does not affect entities already missing the component.
Behavior at Playback: Will throw an error if one of these entities is destroyed before playback. (With safety checks enabled, an exception is thrown. Without safety checks, playback will perform invalid and unsafe memory access.)
Exceptions
Type | Condition |
---|---|
NullReferenceException | Throws if an Allocator was not passed in when the EntityCommandBuffer was created. |
InvalidOperationException | Throws if this EntityCommandBuffer has already been played back. |
RemoveComponentForEntityQuery<T>(EntityQuery)
Records a command to remove a component from all entities matching a query.
Declaration
public void RemoveComponentForEntityQuery<T>(EntityQuery entityQuery)
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | entityQuery | The query specifying the entities from which the component is removed. |
Type Parameters
Name | Description |
---|---|
T | The type of component to remove. |
Remarks
The set of entities matching the query is 'captured' in the method call, and the recorded command stores an array of all these entities.
Does not affect entities already missing the component.
Behavior at Playback: Will throw an error if one of these entities is destroyed before playback. (With safety checks enabled, an exception is thrown. Without safety checks, playback will perform invalid and unsafe memory access.)
Exceptions
Type | Condition |
---|---|
NullReferenceException | Throws if an Allocator was not passed in when the EntityCommandBuffer was created. |
InvalidOperationException | Throws if this EntityCommandBuffer has already been played back. |
RemoveComponentForEntityQuery(EntityQuery, ComponentTypes)
Records a command to remove multiple components from all entities matching a query.
Declaration
public void RemoveComponentForEntityQuery(EntityQuery entityQuery, ComponentTypes componentTypes)
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | entityQuery | The query specifying the entities from which the components are removed. |
ComponentTypes | componentTypes | The types of components to remove. |
Remarks
The set of entities matching the query is 'captured' in the method call, and the recorded command stores an array of all these entities.
Some matching entities may already be missing some or all of the specified components. After this operation, all matching entities will have none of the components.
Behavior at Playback: Will throw an error if one of these entities is destroyed before playback. (With safety checks enabled, an exception is thrown. Without safety checks, playback will perform invalid and unsafe memory access.)
Exceptions
Type | Condition |
---|---|
NullReferenceException | Throws if an Allocator was not passed in when the EntityCommandBuffer was created. |
InvalidOperationException | Throws if this EntityCommandBuffer has already been played back. |