Method SetComponentEnabled
SetComponentEnabled<T>(SystemHandle, bool)
Enable or disable a ComponentType on the specified SystemHandle.
Declaration
public void SetComponentEnabled<T>(SystemHandle systemHandle, bool value) where T : 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 | The component type to enable or disable. This type must implement the IEnableableComponent interface. |
Remarks
This operation does not cause a structural change, and does not affect the current value of the component. To enable/disable components from a job, use SetComponentEnabled(SystemHandle, bool).
Exceptions
Type | Condition |
---|---|
ArgumentException | The SystemHandle does not exist. |
See Also
SetComponentEnabled<T>(Entity, bool)
Enable or disable a ComponentType on the specified Entity.
Declaration
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 IEnableableComponent interface. |
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 EntityQuery that requires that component, and will match a query that excludes that component.
To enable/disable components from a job, use SetComponentEnabled(Entity, bool). To enable/disable an entire Entity, use SetEnabled(Entity, bool) (which, unlike this function, does involve a structural change).
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |
See Also
SetComponentEnabled<T>(EntityQuery, bool)
Sets or clears the "is enabled" bit for the provided component on all entities in all chunks matched by the query, ignoring the current state of any enableable components in the query.
Declaration
public void SetComponentEnabled<T>(EntityQuery query, bool value) where T : IEnableableComponent
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | query | The query whose matching chunks should be affected. |
bool | value | If true, the component |
Type Parameters
Name | Description |
---|---|
T | The component type which should be enabled or disabled on all matching chunks. This type must be included in the query's required types, and must implement IEnableableComponent. |
Remarks
This method ignores the current state of all enableable components in the query. The target component will be enabled or disabled on every entity in every chunk that matches the query. Specifically, this function will enable disabled components on entities, even if the disabled component would cause its entity to not match the query.
To enable or disable a component on all entities that match a query (while respecting the current status of enableable components), the recommended workaround is to use a simple IJobEntity or foreach loop.
If any jobs are currently running which read or write the target component, this function will block until they complete before performing the requested operation.
See Also
SetComponentEnabled(EntityQuery, ComponentType, bool)
Sets or clears the "is enabled" bit for the provided component on all entities in all chunks matched by the query, ignoring the current state of any enableable components in the query.
Declaration
public void SetComponentEnabled(EntityQuery query, ComponentType componentType, bool value)
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | query | The query whose matching chunks should be affected. |
ComponentType | componentType | The component type which should be enabled or disabled on all matching chunks. This type must be included in the query's required types, and must implement IEnableableComponent. |
bool | value | If true, the component |
Remarks
This method ignores the current state of all enableable components in the query. The target component will be enabled or disabled on every entity in every chunk that matches the query. Specifically, this function will enable disabled components on entities, even if the disabled component would cause its entity to not match the query.
To enable or disable a component on all entities that match a query (while respecting the current status of enableable components), the recommended workaround is to use a simple IJobEntity or foreach loop.
If any jobs are currently running which read or write the target component, this function will block until they complete before performing the requested operation.
See Also
SetComponentEnabled(Entity, ComponentType, bool)
Enable or disable ComponentType on the specified Entity.
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. |
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
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 EntityQuery that requires that component, and will match a query that excludes that component.
To enable/disable components from a job, use SetComponentEnabled(Entity, bool). To enable/disable an entire Entity, use SetEnabled(Entity, bool) (which, unlike this function, does involve a structural change).
Exceptions
Type | Condition |
---|---|
ArgumentException | The Entity does not exist. |