Method SetComponentEnabled
SetComponentEnabled(Entity, ComponentType, bool)
Enable or disable Component
Declaration
public void SetComponentEnabled(Entity entity, ComponentType componentType, bool value)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity whose component should be enabled or disabled. |
Component |
componentType | The component type to enable or disable. This type must implement the
IEnableable |
bool | value | True if the specified component should be enabled, or false if it should be disabled. |
Remarks
This operation does not cause a structural change, and does not affect the current value of the component.
An entity with a disabled component will not match an Entity
To enable/disable components from a job, use Set
Exceptions
Type | Condition |
---|---|
Argument |
The Entity does not exist. |
See Also
SetComponentEnabled<T>(Entity, bool)
Enable or disable a Component
Declaration
[GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[] { typeof(BurstCompatibleEnableableComponent) })]
public void SetComponentEnabled<T>(Entity entity, bool value) where T : 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 | The component type to enable or disable. This type must implement the
IEnableable |
Remarks
This operation does not cause a structural change, and does not affect the current value of the component.
An entity with a disabled component will not match an Entity
To enable/disable components from a job, use Set
Exceptions
Type | Condition |
---|---|
Argument |
The Entity does not exist. |