Method SetComponentEnabled
SetComponentEnabled<T>(ref ComponentTypeHandle<T>, int, bool)
Enable or disable a IComponentData on the specified Entity. This operation does not cause a structural change, or affect the value of the component. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Declaration
public readonly void SetComponentEnabled<T>(ref ComponentTypeHandle<T> typeHandle, int entityIndexInChunk, 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. | 
| int | entityIndexInChunk | The index within this chunk of the entity whose component should be checked. | 
| 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. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The Entity does not exist. | 
| ArgumentException | The target component type  | 
See Also
SetComponentEnabled<T>(ComponentTypeHandle<T>, int, bool)
Obsolete. Use SetComponentEnabled<T>(ref ComponentTypeHandle<T>, int, bool) instead.
Declaration
[Obsolete("The typeHandle argument should now be passed by ref. (RemovedAfter Entities 1.0)", false)]
public readonly void SetComponentEnabled<T>(ComponentTypeHandle<T> typeHandle, int entityIndexInChunk, 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. | 
| int | entityIndexInChunk | The index within this chunk of the entity whose component should be checked. | 
| 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. | 
SetComponentEnabled<T>(ref BufferTypeHandle<T>, int, bool)
Enable or disable a IBufferElementData on the specified Entity. This operation does not cause a structural change, or affect the value of the component. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Declaration
public readonly void SetComponentEnabled<T>(ref BufferTypeHandle<T> bufferTypeHandle, int entityIndexInChunk, 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. | 
| int | entityIndexInChunk | The index within this chunk of the entity whose buffer component should be checked. | 
| bool | value | True if the specified buffer component should be enabled, or false if it should be disabled. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The buffer component type to enable or disable. This type must implement the IEnableableComponent interface. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The Entity does not exist. | 
| ArgumentException | The target component type  | 
| InvalidOperationException | 
 | 
See Also
SetComponentEnabled<T>(BufferTypeHandle<T>, int, bool)
Obsolete. Use SetComponentEnabled<T>(ref BufferTypeHandle<T>, int, bool) instead.
Declaration
[Obsolete("The bufferTypeHandle argument should now be passed by ref. (RemovedAfter Entities 1.0)", false)]
public readonly void SetComponentEnabled<T>(BufferTypeHandle<T> bufferTypeHandle, int entityIndexInChunk, 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. | 
| int | entityIndexInChunk | The index within this chunk of the entity whose buffer component should be checked. | 
| bool | value | True if the specified buffer component should be enabled, or false if it should be disabled. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The buffer component type to enable or disable. This type must implement the IEnableableComponent interface. | 
SetComponentEnabled(ref DynamicComponentTypeHandle, int, bool)
Enable or disable a IComponentData on the specified Entity. This operation does not cause a structural change, or affect the value of the component. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.
Declaration
public readonly void SetComponentEnabled(ref DynamicComponentTypeHandle typeHandle, int entityIndexInChunk, bool value)Parameters
| Type | Name | Description | 
|---|---|---|
| DynamicComponentTypeHandle | typeHandle | A type handle for the component type that will be enabled or disabled. | 
| int | entityIndexInChunk | The index within this chunk of the entity whose component should be checked. | 
| bool | value | True if the specified component should be enabled, or false if it should be disabled. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentException | The Entity does not exist. | 
| ArgumentException | The target component type is not present in the this chunk. | 
| ArgumentException | The target component type does not implement IEnableableComponent. |