SetSharedComponent
Records a command to set an unmanaged shared component value on all entities matching a query.
Read time 2 minutesLast updated a day ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
SetSharedComponent<T>(EntityQuery, T, EntityQueryCaptureMode)
Records a command to set an unmanaged shared component value on all entities matching a query.
public void SetSharedComponent<T>(EntityQuery entityQuery, T component, EntityQueryCaptureMode queryCaptureMode) where T : unmanaged, ISharedComponentData
Parameters
The query specifying which entities to add the component value to.
Controls when the entities matching are computed and captured.
entityQueryRemarks
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?]
SetSharedComponent<T>(EntityQuery, T)
Obsolete. Use EntityCommandBuffer.SetSharedComponent instead.
public void SetSharedComponent<T>(EntityQuery entityQuery, T component) where T : unmanaged, ISharedComponentData
Parameters
The query specifying the entities to which the component is added.
SetSharedComponent<T>(Entity, T)
Records a command to set an unmanaged shared component value on an entity.
public void SetSharedComponent<T>(Entity e, T sharedComponent) where T : unmanaged, ISharedComponentData
Parameters
The entity to set the shared component value of.
Remarks
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.
SetSharedComponent<T>(NativeArray<Entity>, T)
Records a command to set an unmanaged shared component value on a NativeArray of entities.
public void SetSharedComponent<T>(NativeArray<Entity> entities, T sharedComponent) where T : unmanaged, ISharedComponentData
Parameters
The NativeArray of entities to set the shared component value of.
Remarks
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.