Method CopyEntities
CopyEntities(NativeArray<Entity>, NativeArray<Entity>)
Clones a set of entities, different from Instantiate because it does not remove the prefab tag component.
Declaration
public void CopyEntities(NativeArray<Entity> srcEntities, NativeArray<Entity> outputEntities)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Entity> | srcEntities | The set of entities to clone |
NativeArray<Entity> | outputEntities | the set of entities that were cloned. outputEntities.Length must match srcEntities.Length |
Remarks
The new entity has the same archetype and component values as the original, however system state components are removed from the clone.
Entity references on components that are being cloned to entities inside the set are remapped to the instantiated entities. This method overload ignores the LinkedEntityGroup component, since the group of entities that will be cloned is passed explicitly.
Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before creating the entity 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.