Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityManager.DestroyEntity

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void DestroyEntity(EntityQuery entityQuery);

Parameters

Parameter Description
entityQuery Defines the components an entity must have to qualify for destruction.

Description

Destroy all entities having a common set of component types.

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 component, this operation will fail if any entities in a LinkedEntityGroup buffer do not also match the query.


Declaration

public void DestroyEntity(NativeArray<Entity> entities);

Parameters

Parameter Description
entities An array containing the Entity objects of the entities to destroy.

Description

Destroys all entities in an array.

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.


Declaration

public void DestroyEntity(NativeSlice<Entity> entities);

Parameters

Parameter Description
entities The slice of an array containing the Entity objects of the entities to destroy.

Description

Destroys all entities in a slice of an array.

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.


Declaration

public void DestroyEntity(Entity entity);

Parameters

Parameter Description
entity The Entity object of the entity to destroy.

Description

Destroys an entity.

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.