# DestroyEntity

> Destroy all entities having a common set of component types.

## Definition

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

## DestroyEntity(EntityQuery)

Destroy all entities having a common set of component types.

```csharp
public void DestroyEntity(EntityQuery entityQuery)
```

### Parameters

**** (\[EntityQuery]\(/engine/7000.0/script-reference/unity/entities/entityquery)): Defines the components an entity must have to qualify for destruction.

### Remarks

Since entities in the same chunk share the same component structure, this function effectively destroys the chunks holding any entities identified by the `entityQueryFilter` parameter.

If any entities matching the query have the [LinkedEntityGroup](/engine/7000.0/script-reference/unity/entities/linkedentitygroup.md) component, this operation will fail if any entities in a [LinkedEntityGroup](/engine/7000.0/script-reference/unity/entities/linkedentitygroup.md) buffer do not also match the query.

## DestroyEntity(NativeArray\<Entity>)

Destroys all entities in an array.

```csharp
public void DestroyEntity(NativeArray<Entity> entities)
```

### Parameters

**** (\[NativeArray\<Entity>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): An array containing the Entity objects of the entities to destroy.

### Remarks

**Important:** This method creates a sync point, which means that the EntityManager waits for all currently running jobs to complete before destroying the entity. No additional jobs can start before the method is finished. A sync point can cause a drop in performance because the ECS framework might not be able to use the processing power of all available cores.

## DestroyEntity(NativeSlice\<Entity>)

Destroys all entities in a slice of an array.

```csharp
public void DestroyEntity(NativeSlice<Entity> entities)
```

### Parameters

**** (\[NativeSlice\<Entity>]\(/engine/7000.0/script-reference/unity/collections/nativeslice1)): The slice of an array containing the Entity objects of the entities to destroy.

### Remarks

**Important:** This method creates a sync point, which means that the EntityManager waits for all currently running jobs to complete before destroying the entity. No additional jobs can start before the method is finished. A sync point can cause a drop in performance because the ECS framework might not be able to use the processing power of all available cores.

## DestroyEntity(Entity)

Destroys an entity.

```csharp
public void DestroyEntity(Entity entity)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The Entity object of the entity to destroy.

### Remarks

**Important:** This method creates a sync point, which means that the EntityManager waits for all currently running jobs to complete before destroying the entity. No additional jobs can start before the method is finished. A sync point can cause a drop in performance because the ECS framework might not be able to use the processing power of all available cores.
