# Instantiate

> Records a command to create an entity with specified entity prefab.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## Instantiate(Entity)

Records a command to create an entity with specified entity prefab.

```csharp
public Entity Instantiate(Entity e)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity prefab.

### Returns

| Type                                                               | Description                                 |
| ------------------------------------------------------------------ | ------------------------------------------- |
| [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) | The root entity of the instantiated prefab. |

### Remarks

An instantiated entity has the same components and component values as the prefab entity, minus the Prefab tag component. If the source entity was destroyed before playback, this command throws an error.

The returned entity is the root of the instantiated prefab. It is valid for use in subsequent commands on this buffer, but has no chunk until the ECB has been played back [EntityCommandBuffer.Playback](/engine/7000.0/script-reference/unity/entities/entitycommandbuffer/playback.md). For a prefab with a `LinkedEntityGroup`, only the root is allocated at record time. The child entity IDs are only available via the root's `LinkedEntityGroup` buffer after playback.

## Instantiate(Entity, NativeArray\<Entity>)

Records a command to create a NativeArray of entities with specified entity prefab.

```csharp
public void Instantiate(Entity e, NativeArray<Entity> entities)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity prefab.**** (\[NativeArray\<Entity>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): A NativeArray that receives the root entities of the instantiated prefabs.

### Remarks

An instantiated entity has the same components and component values as the prefab entity, minus the Prefab tag component. If the source entity was destroyed before playback, this command throws an error.

The filled entities are the roots of each instantiated prefab. They are valid for use in subsequent commands on this buffer, but have no chunk until the ECB has been played back [EntityCommandBuffer.Playback](/engine/7000.0/script-reference/unity/entities/entitycommandbuffer/playback.md). For a prefab with a `LinkedEntityGroup`, only the roots are allocated at record time. The child entity IDs are only available via each root's `LinkedEntityGroup` buffer after playback.
