Method SetComponentEnabled
SetComponentEnabled<T>(Entity, bool)
Records a command to enable or disable a ComponentType 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 void SetComponentEnabled<T>(Entity e, bool value) where T : struct, IEnableableComponent
Parameters
Type | Name | Description |
---|---|---|
Entity | e | 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 IEnableableComponent interface. |
Remarks
At playback, this command throws an error if this entity is destroyed before playback, if this entity is still deferred, if the entity has the Prefab tag, or if the entity doesn't have the component type.
SetComponentEnabled(Entity, ComponentType, bool)
Records a command to enable or disable a ComponentType 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 void SetComponentEnabled(Entity e, ComponentType componentType, bool value)
Parameters
Type | Name | Description |
---|---|---|
Entity | e | The entity whose component should be enabled or disabled. |
ComponentType | componentType | The component type to enable or disable. This type must implement the IEnableableComponent interface. |
bool | value | True if the specified component should be enabled, or false if it should be disabled. |
Remarks
At playback, this command throws an error if this entity is destroyed before playback, if this entity is still deferred, if the entity has the Prefab tag, or if the entity doesn't have the component type.