Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityCommandBuffer.ParallelWriter.SetComponentEnabled

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetComponentEnabled(int sortKey, Entity e, bool value);

Parameters

Parameter Description
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 IJobChunk.Execute.
e The entity whose component should be enabled or disabled.
value True if the specified component should be enabled, or false if it should be disabled.

Description

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.

At playback, this command throws an error if this entity is destroyed before playback, if the entity has the Prefab tag, or if the entity doesn't have the component type.


Declaration

public void SetComponentEnabled(int sortKey, Entity e, ComponentType componentType, bool value);

Parameters

Parameter Description
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 IJobChunk.Execute.
e The entity whose component should be enabled or disabled.
componentType The component type to enable or disable. This type must implement the IEnableableComponent interface.
value True if the specified component should be enabled, or false if it should be disabled.

Description

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.

At playback, this command throws an error if this entity is destroyed before playback, if the entity has the Prefab tag, or if the entity doesn't have the component type.