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

EntityCommandBuffer.CreateEntity

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 Entity CreateEntity(EntityArchetype archetype);

Parameters

Parameter Description
archetype The archetype of the new entity.

Returns

Entity An entity that will be assigned a chunk when this EntityCommandBuffer is played back.

Description

Records a command to create an entity with specified archetype.

At playback, this command throws an error if the archetype contains the Prefab tag.


Declaration

public Entity CreateEntity();

Returns

Entity An entity that will be assigned a chunk when this EntityCommandBuffer is played back.

Description

Records a command to create an entity with no components.


Declaration

public void CreateEntity(EntityArchetype archetype, NativeArray<Entity> entities);

Parameters

Parameter Description
archetype The archetype of the new entities.
entities An array to hold the Entity objects needed to access the new entities. The length of the array determines how many entities are created.

Description

Records a command to create an array of entities with specified archetype.

At playback, the entities will be assigned a chunk. Additionally, this command throws an error if the archetype contains the Prefab tag.


Declaration

public NativeArray<Entity> CreateEntity(int count, Allocator allocator);

Parameters

Parameter Description
count The number of entities to create.
allocator The allocator to use for the returned array.

Returns

NativeArray<Entity> An array of the created entities. Each entity is valid immediately, but Unity doesn't assign it a chunk until the Playback method runs.

Description

Records a command to create a specified number of entities with no components.