Remarks

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.

Properties ExclusiveEntityTransactionDependency

An optional JobHandle that corresponds to the job currently using an ExclusiveEntityTransaction. This job is completed when this EntityManager's World is destroyed.

AddComponentData<T>(EntityQuery, NativeArray<T>)

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.

CompleteDependencyBeforeRO<T>()

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.

CompleteDependencyBeforeRW<T>()

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.

CopyEntitiesFrom(EntityManager, NativeArray<Entity>, NativeArray<Entity>)

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.

EndExclusiveEntityTransaction()

Ends an active ExclusiveEntityTransaction and returns ownership of the EntityManager to the main thread.

GetAllUniqueSharedComponentsManaged<T>(List<T>, List<int>)

Gets a list of all unique shared components of the same type and a corresponding list of indices into the internal shared component list.

GetAllUniqueSharedComponentsManaged<T>(List<T>, List<int>, List<int>)

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.

GetComponentObject<T>(Entity, ComponentType)

Gets the managed UnityEngine.Component object from an entity.

GetComponentObject<T>(SystemHandle, ComponentType)

Gets the managed UnityEngine.Component object from an entity associated with a system.

GetCreatedAndDestroyedEntitiesAsync(NativeList<int>, NativeList<Entity>, NativeList<Entity>)

Detects the created and destroyed entities compared to last time the method was called with the given state.

MoveEntitiesFrom(out NativeArray<Entity>, EntityManager)

Moves all entities managed by the specified EntityManager to the World of this EntityManager and fills an array with their Entity objects.

MoveEntitiesFrom(out NativeArray<Entity>, EntityManager, NativeArray<EntityRemapInfo>)

Moves all entities managed by the specified EntityManager to the World of this EntityManager and fills an array with their Entity objects.

MoveEntitiesFrom(out NativeArray<Entity>, EntityManager, EntityQuery)

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.

MoveEntitiesFrom(out NativeArray<Entity>, EntityManager, EntityQuery, NativeArray<EntityRemapInfo>)

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.

MoveEntitiesFrom(EntityManager, EntityQuery)

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.

SetComponentEnabled(EntityQuery, ComponentType, bool)

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.

SetComponentEnabled<T>(EntityQuery, bool)

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.

Extension Methods

EntityManagerManagedComponentExtensions.AddChunkComponentData<T>(EntityManager, Entity) EntityManagerManagedComponentExtensions.AddChunkComponentData<T>(EntityManager, EntityQuery, T) EntityManagerManagedComponentExtensions.AddComponentData<T>(EntityManager, Entity, T) EntityManagerManagedComponentExtensions.AddComponentData<T>(EntityManager, SystemHandle, T) EntityManagerManagedComponentExtensions.CreateSingleton<T>(EntityManager, FixedString64Bytes) EntityManagerManagedComponentExtensions.CreateSingleton<T>(EntityManager, T, FixedString64Bytes) EntityManagerManagedComponentExtensions.GetChunkComponentData<T>(EntityManager, ArchetypeChunk) EntityManagerManagedComponentExtensions.GetChunkComponentData<T>(EntityManager, Entity) EntityManagerManagedComponentExtensions.GetComponentData<T>(EntityManager, Entity) EntityManagerManagedComponentExtensions.GetComponentData<T>(EntityManager, SystemHandle) EntityManagerManagedComponentExtensions.MoveComponent<T>(EntityManager, Entity, Entity) EntityManagerManagedComponentExtensions.SetChunkComponentData<T>(EntityManager, ArchetypeChunk, T) EntityManagerManagedComponentExtensions.SetComponentData<T>(EntityManager, Entity, T) EntityManagerManagedComponentExtensions.SetComponentData<T>(EntityManager, SystemHandle, T)