Method SetComponentEnabled
SetComponentEnabled<T>(Entity, bool)
Enable or disable the IComponentData of type T on the specified Entity. This operation does not cause a structural change (even if it occurs on a worker thread), 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. The type T must implement the IEnableableComponent interface.
Declaration
public static void SetComponentEnabled<T>(Entity entity, bool value) where T : class, IEnableableComponent
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity whose component should 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 | An unmanaged IComponentData type |
Remarks
Not working in Entities.ForEach, IJobEntity, Utility methods, and Aspects
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |
See Also
SetComponentEnabled<T>(SystemHandle, bool)
Enable or disable the IComponentData of type T on the specified system using a SystemHandle. This operation does not cause a structural change (even if it occurs on a worker thread), or affect the value of the component. For the purposes of EntityQuery matching, a system with a disabled component will behave as if it does not have that component. The type T must implement the IEnableableComponent interface.
Declaration
public static void SetComponentEnabled<T>(SystemHandle systemHandle, bool value) where T : class, IEnableableComponent
Parameters
Type | Name | Description |
---|---|---|
SystemHandle | systemHandle | The system whose component should 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 | An unmanaged IComponentData type |
Remarks
Not working in Entities.ForEach, IJobEntity, Utility methods, and Aspects
Exceptions
Type | Condition |
---|---|
ArgumentException | The SystemHandle does not exist. |