The EntityManager manages entities and components in a World.
The EntityManager provides an API to create, read, update, and destroy entities.
A EntityManager.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.
| Property | Description |
|---|---|
| TotalChunkAddressSpaceInBytes | The total reserved address space for all Chunks in all Worlds. |
| Property | Description |
|---|---|
| Debug | An object providing debugging information and operations. |
| EntityOrderVersion | If this version number increases, it means that a structural change has occurred (Entities created / destroyed or components added / removed) |
| ExclusiveEntityTransactionDependency | An optional JobHandle that corresponds to the job currently using an ExclusiveEntityTransaction. This job is completed if this EntityManager's EntityManager.World is destroyed. |
| GlobalSystemVersion | A counter that increments after every system update. |
| UniversalQuery | An EntityQuery instance that matches all normal components and - excludes system entities - excludes chunk entities |
| UniversalQueryWithSystems | An EntityQuery instance that matches all normal components and - includes system entities - excludes chunk entities |
| World | The EntityManager.World of this EntityManager. |
| WorldUnmanaged | The EntityManager.WorldUnmanaged of this EntityManager. |
| Method | Description |
|---|---|
| AddBuffer | Adds a dynamic buffer component to an entity. |
| AddChunkComponentData | Adds a chunk component to the specified entity. |
| AddComponent | Adds a component to an entity. |
| AddComponentData | 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. |
| AddSharedComponent | Adds a shared component to an entity. |
| AddTransform | Adds a transform to an entity. |
| BeginExclusiveEntityTransaction | Begins an exclusive entity transaction, which allows you to make structural changes inside a Job. |
| CanBeginExclusiveEntityTransaction | Check whether or not a new exclusive entity transaction can begin. |
| CompleteAllTrackedJobs | Waits for all tracked jobs to complete. |
| CompleteDependencyBeforeRO | 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 | 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 | 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. |
| CreateArchetype | Creates an archetype from a set of component types. |
| CreateEntity | Creates an entity having the specified archetype. |
| CreateEntityQuery | Creates a EntityQuery from an array of component types. |
| CreateEntityRemapArray | Creates a remapping array with one element for each entity in the EntityManager.World. |
| CreateSingleton | Creates and supports only a single entity with a given unmanaged component. |
| CreateSingletonBuffer | Creates and supports only a single entity with a given unmanaged component buffer. |
| DestroyEntity | Destroy all entities having a common set of component types. |
| DetachChildren | Break the parent/child links between the target entity and all of its children. Each child entity becomes the root of a new hierarchy. |
| EndExclusiveEntityTransaction | Ends an active ExclusiveEntityTransaction and returns ownership of the EntityManager to the main thread. |
| Equals | Reports whether this EntityManager references the same manager as another instance. |
| Exists | Reports whether an Entity object is still valid. |
| GetAllArchetypes | Gets all the archetypes. |
| GetAllChunks | Gets all the chunks managed by this EntityManager. |
| GetAllChunksAndMetaChunks | Gets all the chunks managed by this EntityManager, including the meta chunks (containing chunk components). |
| GetAllEntities | Gets all the entities managed by this EntityManager. |
| GetAllUniqueSharedComponents | Gets a list of all the unique instances of an unmanaged shared component type. |
| GetAssignableComponentTypes | Gets a list of the types of components that can be assigned to the specified component. |
| GetBuffer | Gets the dynamic buffer of an entity. |
| GetBufferTypeHandle | Gets the dynamic type object required to access a chunk buffer containing elements of type T. |
| GetChunk | Gets the chunk in which the specified entity is stored. |
| GetChunkComponentData | Gets the value of a chunk component. |
| GetComponentCount | Gets the number of component types associated with an entity. |
| GetComponentData | Gets the value of a component for an entity. |
| GetComponentDataRW | Gets the value of a component for an entity associated with a system. |
| GetComponentOrderVersion | Gets the version number of the specified component type. |
| GetComponentTypeHandle | Gets the dynamic type object required to access a chunk component of type T. |
| GetComponentTypes | Gets an entity's component types. |
| GetDynamicComponentTypeHandle | Gets the dynamic type object required to access a chunk component of dynamic type acquired from reflection. |
| GetDynamicSharedComponentTypeHandle | Gets the dynamic type object required to access a shared component of the given type. |
| GetEntityTypeHandle | Gets the dynamic type object required to access the Entity component of a chunk. |
| GetHashCode | Computes a hash code for this object |
| GetName | Gets the name assigned to an entity. |
| GetSharedComponent | Gets a shared component from an entity. |
| GetSharedComponentCount | Gets the number of shared components managed by this EntityManager. |
| GetSharedComponentDataBoxed | Retrieves a shared component value as a managed boxed object. |
| GetSharedComponentIndex | Retrieves the index of the unmanaged shared component for an entity. |
| GetSharedComponentOrderVersion | Gets the version number of the specified shared component. |
| GetSharedComponentTypeHandle | Gets the dynamic type object required to access a shared component of type T. |
| GetStorageInfo | Gets a struct containing information about the archetype in which an entity is stored. |
| GetTransformRef | Gets a reference to the transform of an entity. |
| GetTransformTypeHandle | Gets a type handle for accessing entity transforms in a chunk. |
| HasBuffer | Checks whether an entity has a dynamic buffer of a specific IBufferElementData type. |
| HasChunkComponent | Checks whether the chunk containing an entity has a specific type of component. |
| HasComponent | Checks whether an entity has a specific type of component. |
| Instantiate | Clones an entity. |
| IsComponentEnabled | Checks whether a given ComponentType is enabled on the specified Entity. |
| IsEnabled | Check whether an entire entity has the Disabled tag component. |
| IsQueryValid | Check if an entity query is still valid |
| MoveEntitiesFrom | Moves all entities managed by the specified EntityManager to the world of this EntityManager. |
| PrepareForDeserialize | Prepares an empty EntityManager.World to load serialized entities. |
| RemoveChunkComponent | Removes a chunk component from the specified entity. |
| RemoveChunkComponentData | Removes a chunk component from the chunks identified by an EntityQuery. |
| RemoveComponent | Removes multiple components from a specified colleciton of entities. |
| SetArchetype | Adds and removes components of an entity to match the specified EntityArchetype. |
| SetChunkComponentData | Sets the value of a chunk component. |
| SetComponentData | Sets the value of a component of an entity. |
| SetComponentEnabled | Enable or disable a ComponentType on the specified SystemHandle. |
| SetEnabled | Adds or removes the Disabled component to an Entity. |
| SetName | Sets the name of an entity. |
| SetParent | Establish a new link between a child and parent entity. |
| SetSharedComponent | Sets the shared component of all entities in the query. |
| SwapComponents | Swaps the components of two entities. |
| Operator | Description |
|---|---|
| operator != | Compare two EntityManager objects for inequality |
| operator == | Compare two EntityManager objects for equality |