Method AddComponent
AddComponent(ForEachLambdaJobDescription, ComponentType)
Adds a component to a set of entities selected by the query you have defined using WithAny/WithAll/WithNone
Declaration
public static void AddComponent(this ForEachLambdaJobDescription description, ComponentType componentType)Parameters
| Type | Name | Description | 
|---|---|---|
| ForEachLambdaJobDescription | description | The target object | 
| ComponentType | componentType | The type of component to add. | 
Remarks
Can add any kind of component.
Adding a component changes an entity's archetype and results in the entity being moved to a different chunk.
The added components have the default values for the type.
Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before adding the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.
AddComponent(ForEachLambdaJobDescription, in ComponentTypeSet)
Adds components to a set of entities selected by the query you have defined using WithAny/WithAll/WithNone
Declaration
public static void AddComponent(this ForEachLambdaJobDescription description, in ComponentTypeSet componentTypes)Parameters
| Type | Name | Description | 
|---|---|---|
| ForEachLambdaJobDescription | description | The target object | 
| ComponentTypeSet | componentTypes | The type of components to add. | 
Remarks
Can add any kinds of components.
The added components have the default values for the type.
Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before adding the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.
AddComponent<T>(ForEachLambdaJobDescription)
Adds a component to a set of entities selected by the query you have defined using WithAny/WithAll/WithNone
Declaration
public static void AddComponent<T>(this ForEachLambdaJobDescription description) where T : unmanaged, IComponentDataParameters
| Type | Name | Description | 
|---|---|---|
| ForEachLambdaJobDescription | description | The target object | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type of component to add. | 
Remarks
Can add any kind of component except chunk components.
Adding a component changes an entity's archetype and results in the entity being moved to a different chunk.
The added components have the default values for the type.
Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before adding the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.