Method SetComponentEnabled
SetComponentEnabled<T>(int, 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>(int sortKey, Entity e, bool value) where T : struct, IEnableableComponent
Parameters
Type | Name | Description |
---|---|---|
int | sortKey | A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128). |
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(int, 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(int sortKey, Entity e, ComponentType componentType, bool value)
Parameters
Type | Name | Description |
---|---|---|
int | sortKey | A unique index for each set of commands added to this EntityCommandBuffer across all parallel jobs writing commands to this buffer. The ChunkIndexInQuery provided by IJobEntity is an appropriate value to use for this parameter. In an IJobChunk pass the 'unfilteredChunkIndex' value from Execute(in ArchetypeChunk, int, bool, in v128). |
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.