Method SetComponentEnabled
SetComponentEnabled<T>(EntityCommandBuffer, 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 static void SetComponentEnabled<T>(this EntityCommandBuffer ecb, Entity e, bool value) where T : class, IEnableableComponent, new()
Parameters
Type | Name | Description |
---|---|---|
EntityCommandBuffer | ecb | This entity command buffer. |
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.