The EntityManager provides an API to create, read, update, and destroy entities.
A
World
has one EntityManager, which manages all the entities for that World.
Many EntityManager operations result in
structural changes
that change the layout of entities in memory.
Before it can perform such operations, the EntityManager must wait for all running Jobs to complete, an event
called a
sync point
. A sync point both blocks the main thread and prevents the application from taking
advantage of all available cores as the running Jobs wind down.
Although you cannot prevent sync points entirely, you should avoid them as much as possible. To this end, the ECS
framework provides the
EntityCommandBuffer
, which allows you to queue structural changes so that
they all occur at one time in the frame.
An optional
JobHandle
that corresponds to the job currently using an ExclusiveEntityTransaction.
This job is completed when this EntityManager's
World
is destroyed.
Adds a component to a set of entities defined by the EntityQuery and
sets the component of each entity in the query to the value in the component array.
Completes the dependency chain required for this component to have read access.
So it completes all write dependencies of the component to allow for reading.
Completes the dependency chain required for this component to have read and write access.
So it completes all write dependencies of the component to allow for reading,
and it completes all read dependencies, so we can write to it.
Instantiates / Copies all entities from srcEntityManager and copies them into this EntityManager.
Entity references on components that are being cloned to entities inside the srcEntities set are remapped to the instantiated entities.
Gets a list of all unique shared components of the same type and a corresponding list of indices into the
internal shared component list and their internal versions.
Moves a selection of the entities managed by the specified EntityManager to the
World
of this EntityManager
and fills an array with their
Entity
objects.
Moves a selection of the entities managed by the specified EntityManager to the
World
of this EntityManager
and fills an array with their
Entity
objects.
Moves a selection of the entities managed by the specified EntityManager to the
World
of this EntityManager
and fills an array with their
Entity
objects.
Sets or clears the "is enabled" bit for the provided component on all entities in all chunks matched by the
query, ignoring the current state of any enableable components in the query.
Sets or clears the "is enabled" bit for the provided component on all entities in all chunks matched by the
query, ignoring the current state of any enableable components in the query.