Documentation

Unity Engine

Download Unity

Unity Engine

Instantiate(WorldUnmanaged, Entity)

Clones an entity from any world into the given world.
Read time 1 minuteLast updated 2 days ago

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public static Entity Instantiate(WorldUnmanaged dstWorld, Entity srcEntity)

Parameters

The world to create the clone in.

srcEntity

The entity to clone, in any world.

Returns

Type

Description

EntityThe clone, in
dstWorld
.

Remarks

The clone has the same components and values as the source, without Prefab and cleanup components. If the source has a LinkedEntityGroup, the whole group is cloned, and references between the cloned entities point at the clones.
When
srcEntity
is in another world, references to entities outside the group become Entity.Null, because they point into the source world.
This is a structural change in
dstWorld
. Instantiating from another world also completes the source world's jobs that write to the components being cloned.