Struct EntityManager
The EntityManager manages entities and components in a World.
Namespace: Unity.Entities
Assembly: solution.dll
Syntax
[Preserve]
[NativeContainer]
[GenerateTestsForBurstCompatibility]
[BurstCompile]
public struct EntityManager
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
Name | Description |
---|---|
Debug | An object providing debugging information and operations. |
EntityCapacity | The capacity of the internal entities array. |
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 when this EntityManager's World is destroyed. |
GlobalSystemVersion | A counter that increments after every system update. |
TotalChunkAddressSpaceInBytes | The total reserved address space for all Chunks in all Worlds. |
UniversalQuery | An EntityQuery instance that matches all normal components and
|
UniversalQueryWithSystems | An EntityQuery instance that matches all normal components and
|
Version | Obsolete. Use EntityOrderVersion instead. |
World | The World of this EntityManager. |
WorldUnmanaged | The WorldUnmanaged of this EntityManager. |
Methods
Name | Description |
---|---|
AddBuffer<T>(Entity) | Adds a dynamic buffer component to an entity. |
AddChunkComponentData<T>(Entity) | Adds a chunk component to the specified entity. |
AddChunkComponentData<T>(EntityQuery, T) | Adds a chunk component to each of the chunks identified by an EntityQuery and sets the component values. |
AddComponent(NativeArray<Entity>, ComponentType) | Adds a component to a set of entities. |
AddComponent(NativeArray<Entity>, in ComponentTypeSet) | Adds components to a specified collection of entities. |
AddComponent(Entity, ComponentType) | Adds a component to an entity. |
AddComponent(Entity, in ComponentTypeSet) | Adds a set of component to an entity. |
AddComponent(EntityQuery, ComponentType) | Adds a component to a set of entities defined by a EntityQuery. |
AddComponent(EntityQuery, in ComponentTypeSet) | Adds components to a set of entities defined by a EntityQuery. |
AddComponent(SystemHandle, ComponentType) | Adds a component to an entity associated with a system. |
AddComponent(SystemHandle, in ComponentTypeSet) | Adds a set of component to an entity associated with a system. |
AddComponentData<T>(Entity, T) | Adds a component to an entity and set the value of that component. |
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. |
AddComponentData<T>(SystemHandle, T) | Adds a component to an entity associated with a system and sets the value of that component. |
AddComponentObject(Entity, object) | Adds a managed UnityEngine.Component object to an entity. |
AddComponentObject(SystemHandle, object) | Adds a managed UnityEngine.Component object to an entity associated with a system. |
AddComponent<T>(NativeArray<Entity>) | Adds a component to a set of entities. |
AddComponent<T>(Entity) | Adds a component to an entity. |
AddComponent<T>(EntityQuery) | Adds a component to a set of entities defined by a EntityQuery. |
AddComponent<T>(SystemHandle) | Adds a component to an entity associated with a system. |
AddComponents(Entity, in ComponentTypeSet) | Obsolete. Use AddComponent(Entity, ComponentType) instead. |
AddSharedComponentData<T>(Entity, T) | Obsolete. Use AddSharedComponentManaged<T>(Entity, T) instead. |
AddSharedComponentData<T>(EntityQuery, T) | Obsolete. Use AddSharedComponentManaged<T>(Entity, T) instead. |
AddSharedComponentManaged<T>(NativeArray<Entity>, T) | Adds a shared component to an array of entities |
AddSharedComponentManaged<T>(Entity, T) | Adds a shared component to an entity. |
AddSharedComponentManaged<T>(EntityQuery, T) | Adds a possibly-managed shared component to a set of entities defined by a EntityQuery. |
AddSharedComponent<T>(NativeArray<Entity>, T) | Adds a shared component to multiple entities |
AddSharedComponent<T>(Entity, T) | Adds a shared component to an entity. |
AddSharedComponent<T>(EntityQuery, T) | Adds an unmanaged shared component to a set of entities defined by a EntityQuery. |
AddUnmanagedSharedComponentData<T>(Entity, T) | Obsolete. Use AddSharedComponent<T>(Entity, T) instead. |
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. |
CompleteAllJobs() | Obsolete. Use CompleteAllTrackedJobs() instead. |
CompleteAllTrackedJobs() | Waits for all tracked jobs to complete. |
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. |
CopyAndReplaceEntitiesFrom(EntityManager) | Copies all entities from srcEntityManager and replaces all entities in this EntityManager |
CopyEntities(NativeArray<Entity>, NativeArray<Entity>) | Clones a set of entities, different from Instantiate because it does not remove the prefab tag component. |
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. |
CreateArchetype(ReadOnlySpan<ComponentType>) | Creates an archetype from a set of component types. |
CreateArchetype(NativeArray<ComponentType>) | Creates an archetype from a set of component types. |
CreateArchetype(params ComponentType[]) | Creates an archetype from a set of component types. |
CreateEntity() | Creates an entity with no components. |
CreateEntity(ReadOnlySpan<ComponentType>) | Creates an entity having components of the specified types. |
CreateEntity(params ComponentType[]) | Creates an entity having components of the specified types. |
CreateEntity(EntityArchetype) | Creates an entity having the specified archetype. |
CreateEntity(EntityArchetype, int) | Creates a set of entities of the specified archetype. |
CreateEntity(EntityArchetype, int, AllocatorHandle) | Creates a set of entities of the specified archetype. |
CreateEntity(EntityArchetype, NativeArray<Entity>) | Creates a set of entities of the specified archetype. |
CreateEntityQuery(params ComponentType[]) | Creates a EntityQuery from an array of component types. |
CreateEntityQuery(in EntityQueryBuilder) | Creates an EntityQuery from an EntityQueryBuilder. |
CreateEntityQuery(params EntityQueryDesc[]) | Creates a EntityQuery from an EntityQueryDesc. |
CreateEntityRemapArray(AllocatorHandle) | Creates a remapping array with one element for each entity in the World. |
CreateSingletonBuffer<T>(FixedString64Bytes) | Creates and supports only a single entity with a given unmanaged component buffer. |
CreateSingleton<T>(FixedString64Bytes) | Creates and supports only a single entity with a given unmanaged component. |
CreateSingleton<T>(T, FixedString64Bytes) | Creates and supports only a single entity with a given unmanaged component. |
DestroyAndResetAllEntities() | Destroys all entities in the EntityManager and resets the internal entity ID version table. |
DestroyEntity(NativeArray<Entity>) | Destroys all entities in an array. |
DestroyEntity(NativeSlice<Entity>) | Destroys all entities in a slice of an array. |
DestroyEntity(Entity) | Destroys an entity. |
DestroyEntity(EntityQuery) | Destroy all entities having a common set of component types. |
EndExclusiveEntityTransaction() | Ends an active ExclusiveEntityTransaction and returns ownership of the EntityManager to the main thread. |
Equals(object) | Reports whether this EntityManager references the same manager as another object. |
Equals(EntityManager) | Reports whether this EntityManager references the same manager as another instance. |
Exists(Entity) | Reports whether an Entity object is still valid. |
GetAllArchetypes(NativeList<EntityArchetype>) | Gets all the archetypes. |
GetAllChunks(Allocator) | Gets all the chunks managed by this EntityManager. |
GetAllChunks(AllocatorHandle) | Gets all the chunks managed by this EntityManager. |
GetAllChunksAndMetaChunks(Allocator) | Gets all the chunks managed by this EntityManager, including the meta chunks (containing chunk components). |
GetAllChunksAndMetaChunks(AllocatorHandle) | Gets all the chunks managed by this EntityManager, including the meta chunks (containing chunk components). |
GetAllEntities(Allocator) | Gets all the entities managed by this EntityManager. |
GetAllEntities(AllocatorHandle) | Gets all the entities managed by this EntityManager. |
GetAllEntities(AllocatorHandle, GetAllEntitiesOptions) | Gets all the entities managed by this EntityManager. |
GetAllUniqueSharedComponentData<T>(List<T>) | Obsolete. Use GetAllUniqueSharedComponentsManaged<T>(List<T>) instead. |
GetAllUniqueSharedComponentData<T>(List<T>, List<int>) | Obsolete. Use GetAllUniqueSharedComponentsManaged<T>(List<T>, List<int>) instead. |
GetAllUniqueSharedComponentData<T>(List<T>, List<int>, List<int>) | Obsolete. Use GetAllUniqueSharedComponentsManaged<T>(List<T>, List<int>, List<int>) instead. |
GetAllUniqueSharedComponentsManaged<T>(List<T>) | Gets a list of all the unique instances of a shared component type. |
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. |
GetAllUniqueSharedComponents<T>(out NativeList<T>, AllocatorHandle) | Gets a list of all the unique instances of an unmanaged shared component type. |
GetAspect<T>(Entity) | Look up an aspect for an entity. |
GetAssignableComponentTypes(Type) | Gets a list of the types of components that can be assigned to the specified component. |
GetAssignableComponentTypes(Type, List<Type>) | Gets a list of the types of components that can be assigned to the specified component. |
GetBufferTypeHandle<T>(bool) | Gets the dynamic type object required to access a chunk buffer containing elements of type T. |
GetBuffer<T>(Entity, bool) | Gets the dynamic buffer of an entity. |
GetBuffer<T>(SystemHandle, bool) | Gets the dynamic buffer of an entity associated with a system. |
GetChunk(Entity) | Gets the chunk in which the specified entity is stored. |
GetChunkComponentData<T>(ArchetypeChunk) | Gets the value of a chunk component. |
GetChunkComponentData<T>(Entity) | Gets the value of chunk component for the chunk containing the specified entity. |
GetComponentCount(Entity) | Gets the number of component types associated with an entity. |
GetComponentDataRW<T>(SystemHandle) | Gets the value of a component for an entity associated with a system. |
GetComponentData<T>(Entity) | Gets the value of a component for an entity. |
GetComponentData<T>(SystemHandle) | Gets the value of a component for an entity associated with a system. |
GetComponentObject<T>(Entity) | Gets the managed UnityEngine.Component object from an entity. |
GetComponentObject<T>(Entity, ComponentType) | Gets the managed UnityEngine.Component object from an entity. |
GetComponentObject<T>(SystemHandle) | Gets the managed UnityEngine.Component object from an entity associated with a system. |
GetComponentObject<T>(SystemHandle, ComponentType) | Gets the managed UnityEngine.Component object from an entity associated with a system. |
GetComponentOrderVersion<T>() | Gets the version number of the specified component type. |
GetComponentTypeHandle<T>(bool) | Gets the dynamic type object required to access a chunk component of type T. |
GetComponentTypes(Entity, Allocator) | Gets an entity's component types. |
GetComponentTypes(Entity, AllocatorHandle) | Gets an entity's component types. |
GetComponentTypes(SystemHandle, Allocator) | Gets a system entity's component types. |
GetComponentTypes(SystemHandle, AllocatorHandle) | Gets a system entity's component types. |
GetCreatedAndDestroyedEntities(NativeList<int>, NativeList<Entity>, NativeList<Entity>) | Detects the created and destroyed entities compared to last time the method was called with the given state. |
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. |
GetDynamicComponentTypeHandle(ComponentType) | Gets the dynamic type object required to access a chunk component of dynamic type acquired from reflection. |
GetDynamicSharedComponentTypeHandle(ComponentType) | Gets the dynamic type object required to access a shared component of the given type. |
GetEnabled(Entity) | Obsolete. Use IsEnabled(Entity) instead. |
GetEntityQueryMask(EntityQuery) | This method is obsolete. Use GetEntityQueryMask() instead. |
GetEntityTypeHandle() | Gets the dynamic type object required to access the Entity component of a chunk. |
GetHashCode() | Computes a hash code for this object |
GetName(Entity) | Gets the name assigned to an entity. |
GetName(Entity, out FixedString64Bytes) | Gets the name assigned to an entity. |
GetSharedComponentCount() | Gets the number of shared components managed by this EntityManager. |
GetSharedComponentDataBoxed(int, TypeIndex) | Retrieves a shared component value as a managed boxed object. |
GetSharedComponentDataIndex<T>(Entity) | Retrieves the index of the unmanaged shared component data value for an entity. |
GetSharedComponentData<T>(int) | Obsolete. Use GetSharedComponentManaged<T>(int) instead. |
GetSharedComponentData<T>(Entity) | Obsolete. Use GetSharedComponentManaged<T>(Entity) instead. |
GetSharedComponentIndexManaged<T>(Entity) | Retrieves the index of the managed or unmanaged shared component for an entity. |
GetSharedComponentIndex<T>(Entity) | Retrieves the index of the unmanaged shared component for an entity. |
GetSharedComponentManaged<T>(int) | Gets a shared component by index. |
GetSharedComponentManaged<T>(Entity) | Gets a shared component from an entity. |
GetSharedComponentOrderVersionManaged<T>(T) | Gets the version number of the specified shared component. |
GetSharedComponentOrderVersion<T>(T) | Gets the version number of the specified shared component. |
GetSharedComponentTypeHandle<T>() | Gets the dynamic type object required to access a shared component of type T. |
GetSharedComponent<T>(int) | Gets a shared component by index. |
GetSharedComponent<T>(Entity) | Gets a shared component from an entity. |
GetStorageInfo(Entity) | Gets a struct containing information about the archetype in which an entity is stored. |
GetUnmanagedSharedComponentDataIndex<T>(Entity) | Obsolete. Use GetSharedComponentIndex<T>(Entity) instead. |
GetUnmanagedSharedComponentData<T>(int) | Obsolete. Use GetSharedComponent<T>(int) instead. |
GetUnmanagedSharedComponentData<T>(Entity) | Obsolete. Use GetSharedComponent<T>(Entity) instead. |
HasBuffer<T>(Entity) | Checks whether an entity has a dynamic buffer of a specific IBufferElementData type. |
HasChunkComponent<T>(Entity) | Checks whether the chunk containing an entity has a specific type of component. |
HasComponent(Entity, ComponentType) | Checks whether an entity has a specific type of component. |
HasComponent(SystemHandle, ComponentType) | Checks whether an entity associated with a system has a specific type of component. |
HasComponent<T>(Entity) | Checks whether an entity has a specific type of component. |
HasComponent<T>(SystemHandle) | Checks whether an entity associated with a system has a specific type of component. |
Instantiate(NativeArray<Entity>, NativeArray<Entity>) | Clones a set of entities. |
Instantiate(Entity) | Clones an entity. |
Instantiate(Entity, int, AllocatorHandle) | Makes multiple clones of an entity. |
Instantiate(Entity, NativeArray<Entity>) | Makes multiple clones of an entity. |
IsComponentEnabled(Entity, ComponentType) | Checks whether a given ComponentType is enabled on the specified Entity. |
IsComponentEnabled<T>(Entity) | Checks whether a given ComponentType is enabled on the specified Entity. |
IsComponentEnabled<T>(SystemHandle) | Checks whether a given ComponentType is enabled on the specified system using SystemHandle. |
IsEnabled(Entity) | Check whether an entire entity has the Disabled tag component. |
IsQueryValid(EntityQuery) | Check if an entity query is still valid |
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) | Moves all entities managed by the specified EntityManager to the world of this EntityManager. |
MoveEntitiesFrom(EntityManager, NativeArray<EntityRemapInfo>) | Moves all entities managed by the specified EntityManager to the World of this EntityManager. |
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. |
MoveEntitiesFrom(EntityManager, EntityQuery, NativeArray<EntityRemapInfo>) | Moves a selection of the entities managed by the specified EntityManager to the World of this EntityManager. |
PrepareForDeserialize() | Prepares an empty World to load serialized entities. |
RemoveChunkComponentData<T>(EntityQuery) | Removes a chunk component from the chunks identified by an EntityQuery. |
RemoveChunkComponent<T>(Entity) | Removes a chunk component from the specified entity. |
RemoveComponent(NativeArray<Entity>, ComponentType) | Remove a component from a set of entities. |
RemoveComponent(NativeArray<Entity>, in ComponentTypeSet) | Removes multiple components from a specified colleciton of entities. |
RemoveComponent(Entity, ComponentType) | Removes a component from an entity. |
RemoveComponent(Entity, in ComponentTypeSet) | Removes multiple components from an entity. |
RemoveComponent(EntityQuery, ComponentType) | Removes a component from a set of entities defined by an EntityQuery. |
RemoveComponent(EntityQuery, in ComponentTypeSet) | Removes a set of components from a set of entities defined by an EntityQuery. |
RemoveComponent(SystemHandle, ComponentType) | Removes a component from an entity associated with a system. |
RemoveComponent<T>(NativeArray<Entity>) | Removes a component from a set of entities. |
RemoveComponent<T>(Entity) | Removes a component from an entity. |
RemoveComponent<T>(EntityQuery) | Removes a component from a set of entities defined by a EntityQuery. |
RemoveComponent<T>(SystemHandle) | Removes a component from an entity associated with a system. |
SetArchetype(Entity, EntityArchetype) | Adds and removes components of an entity to match the specified EntityArchetype. |
SetChunkComponentData<T>(ArchetypeChunk, T) | Sets the value of a chunk component. |
SetComponentData<T>(Entity, T) | Sets the value of a component of an entity. |
SetComponentData<T>(SystemHandle, T) | Sets the value of a component of an entity associated with a system. |
SetComponentEnabled(Entity, ComponentType, bool) | Enable or disable ComponentType on the specified Entity. |
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>(Entity, bool) | Enable or disable a ComponentType on the specified Entity. |
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. |
SetComponentEnabled<T>(SystemHandle, bool) | Enable or disable a ComponentType on the specified SystemHandle. |
SetEnabled(Entity, bool) | |
SetName(Entity, FixedString64Bytes) | Sets the name of an entity. |
SetSharedComponentData<T>(Entity, T) | Obsolete. Use SetSharedComponentManaged<T>(Entity, T) instead. |
SetSharedComponentData<T>(EntityQuery, T) | Obsolete. Use SetSharedComponentManaged<T>(Entity, T) instead. |
SetSharedComponentManaged<T>(NativeArray<Entity>, T) | Sets the shared component on an array of entities |
SetSharedComponentManaged<T>(Entity, T) | Sets the shared component of an entity. |
SetSharedComponentManaged<T>(EntityQuery, T) | Sets the shared component of all entities in the query. |
SetSharedComponent<T>(NativeArray<Entity>, T) | Sets the shared component value on an array of entities |
SetSharedComponent<T>(Entity, T) | Sets the shared component of an entity. |
SetSharedComponent<T>(EntityQuery, T) | Sets the shared component of all entities in the query. |
SetUnmanagedSharedComponentData<T>(Entity, T) | Obsolete. Use SetSharedComponent<T>(Entity, T) instead. |
SwapComponents(ArchetypeChunk, int, ArchetypeChunk, int) | Swaps the components of two entities. |
Operators
Name | Description |
---|---|
operator ==(EntityManager, EntityManager) | Compare two EntityManager objects for equality |
operator !=(EntityManager, EntityManager) | Compare two EntityManager objects for inequality |