Method SetComponentEnabledForAll
SetComponentEnabledForAll<T>(ref ComponentTypeHandle<T>, bool)
Enable or disable a IComponentData on all entities in this chunk.
Declaration
public readonly void SetComponentEnabledForAll<T>(ref ComponentTypeHandle<T> typeHandle, bool value) where T : IComponentData, IEnableableComponent, new()Parameters
| Type | Name | Description | 
|---|---|---|
| ComponentTypeHandle<T> | typeHandle | A type handle for the component type that will be enabled or disabled. | 
| bool | value | True if the specified component should be enabled, or false if it should be disabled. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The component type to enable or disable. This type must implement the IEnableableComponent interface. | 
Remarks
This is more efficient than calling SetComponentEnabled(ref DynamicComponentTypeHandle, int, bool) on each entity individually, but has the same net result. This operation does not cause a structural change, or affect the value of the components. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The target component type  | 
| ArgumentException | 
SetComponentEnabledForAll<T>(ref BufferTypeHandle<T>, bool)
Enable or disable an IBufferElementData on all entities in this chunk.
Declaration
public readonly void SetComponentEnabledForAll<T>(ref BufferTypeHandle<T> bufferTypeHandle, bool value) where T : unmanaged, IBufferElementData, IEnableableComponentParameters
| Type | Name | Description | 
|---|---|---|
| BufferTypeHandle<T> | bufferTypeHandle | A type handle for the buffer component type that will be enabled or disabled. | 
| bool | value | True if the specified component should be enabled, or false if it should be disabled. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The component type to enable or disable. This type must implement the IEnableableComponent interface. | 
Remarks
This is more efficient than calling SetComponentEnabled(ref DynamicComponentTypeHandle, int, bool) on each entity individually, but has the same net result. This operation does not cause a structural change, or affect the value of the components. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The target component type  | 
| ArgumentException | 
SetComponentEnabledForAll(ref DynamicComponentTypeHandle, bool)
Enable or disable a component on all entities in this chunk.
Declaration
public readonly void SetComponentEnabledForAll(ref DynamicComponentTypeHandle typeHandle, bool value)Parameters
| Type | Name | Description | 
|---|---|---|
| DynamicComponentTypeHandle | typeHandle | A type handle for the component type that will be enabled or disabled. This component must implement the IEnableableComponent interface. | 
| bool | value | True if the specified component should be enabled, or false if it should be disabled. | 
Remarks
This is more efficient than calling SetComponentEnabled(ref DynamicComponentTypeHandle, int, bool) on each entity individually, but has the same net result. This operation does not cause a structural change, or affect the value of the components. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The target component type is not present in the this chunk. | 
| ArgumentException | Thrown if this chunk does not have the target component type. | 
| ArgumentException | Thrown if the component type does not implement IEnableableComponent. |