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

EntityCommandBuffer.SetSharedComponent

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 SetSharedComponent(EntityQuery entityQuery, T component, EntityQueryCaptureMode queryCaptureMode);

Parameters

Parameter Description
entityQuery The query specifying which entities to add the component value to.
component The component value to add.
queryCaptureMode Controls when the entities matching entityQuery are computed and captured.

Description

Records a command to set an unmanaged shared component value on all entities matching a query.

Fails if any of the entities do not have the type of shared component. [todo: should it be required that the component type is included in the query?]


Obsolete This method now takes an extra parameter to control when the query is evaluated. To preserve the current semantics, use EntityQueryCaptureMode.AtRecord (RemovedAfter Entities 2.0).

Declaration

public void SetSharedComponent(EntityQuery entityQuery, T component);

Parameters

Parameter Description
entityQuery The query specifying the entities to which the component is added.
component The component value to set.

Description

Obsolete. Use EntityCommandBuffer.SetSharedComponent instead.


Declaration

public void SetSharedComponent(Entity e, T sharedComponent);

Parameters

Parameter Description
e The entity to set the shared component value of.
sharedComponent The shared component value to set.

Description

Records a command to set an unmanaged shared component value on an entity.

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 shared component type.


Declaration

public void SetSharedComponent(NativeArray<Entity> entities, T sharedComponent);

Parameters

Parameter Description
entities The NativeArray of entities to set the shared component value of.
sharedComponent The shared component value to set.

Description

Records a command to set an unmanaged shared component value on a NativeArray of entities.

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