GlobalEntityManager
Reads and changes entities without first looking up the World that owns them.
Read time 2 minutesLast updated a day ago
Definition
- Type: Class
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
public static class GlobalEntityManager
Remarks
Every per-entity method comes in two forms:
" acts in whichever world owns the entity. Use it when the world is incidental, for example when the entity came from another world, or from a reference stored on a component. " acts in the given world and behaves exactly like : an entity from another world is treated as missing. Use it when the entity must be in that world.
X(entity)X(world, entity)world.EntityManager.X(entity)Methods that create something take the world it goes into, because there's no entity to take it from. GlobalEntityManager.Instantiate copies an entity from any world into the given world.
Values that are only meaningful in one world, such as a shared component index, come back with that world.
Static Methods
Method | Description |
|---|---|
| AddComponent | Adds a component to an entity. |
| AddComponentData | Adds a component to an entity and sets its value. |
| AddSharedComponent | Adds a shared component to an entity. |
| CreateArchetype | Creates an archetype in the given world. |
| CreateEntity | Creates an entity with no components in the given world. |
| DestroyEntity | Destroys an entity. |
| Exists | Checks whether an entity exists in any world. |
| GetBuffer | Gets the dynamic buffer of an entity. |
| GetComponentData | Gets the value of a component for an entity. |
| GetComponentDataRW | Gets a read/write reference to a component of an entity. |
| GetName | Gets the name of an entity. |
| GetSharedComponent | Gets the value of a shared component of an entity. |
| GetSharedComponentIndex | Gets the index of a shared component value of an entity, and the world the index belongs to. |
| GetWorld | Gets the managed world that owns an entity. |
| GetWorldUnmanaged | Gets the world that owns an entity. |
| HasBuffer | Checks whether an entity has a dynamic buffer of a specific type. |
| HasComponent | Checks whether an entity has a specific type of component. |
| Instantiate | Clones an entity from any world into the given world. |
| IsComponentEnabled | Checks whether an enableable component of an entity is enabled. |
| RemoveComponent | Removes a component from an entity. |
| SetComponentData | Sets the value of a component of an entity. |
| SetComponentEnabled | Enables or disables an enableable component of an entity. |
| SetName | Sets the name of an entity. |
| SetSharedComponent | Sets the value of a shared component of an entity. |