Entitas Use context.CreateEntity() to create a new entity and entity.Destroy() to destroy it. You can add, replace and remove IComponent to an entity. Occurs when a component gets added. All event handlers will be removed when the entity gets destroyed by the context. Occurs when a component gets removed. All event handlers will be removed when the entity gets destroyed by the context. Occurs when a component gets replaced. All event handlers will be removed when the entity gets destroyed by the context. Occurs when an entity gets released and is not retained anymore. All event handlers will be removed when the entity gets destroyed by the context. Occurs when calling entity.Destroy(). All event handlers will be removed when the entity gets destroyed by the context. The total amount of components an entity can possibly have. Each entity has its own unique creationIndex which will be set by the context when you create the entity. The context manages the state of an entity. Active entities are enabled, destroyed entities are not. componentPools is set by the context which created the entity and is used to reuse removed components. Removed components will be pushed to the componentPool. Use entity.CreateComponent(index, type) to get a new or reusable component from the componentPool. Use entity.GetComponentPool(index) to get a componentPool for a specific component index. The contextInfo is set by the context which created the entity and contains information about the context. It's used to provide better error messages. Automatic Entity Reference Counting (AERC) is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point. Adds a component at the specified index. You can only have one component at an index. Each component type must have its own constant index. The prefered way is to use the generated methods from the code generator. Removes a component at the specified index. You can only remove a component at an index if it exists. The prefered way is to use the generated methods from the code generator. Replaces an existing component at the specified index or adds it if it doesn't exist yet. The prefered way is to use the generated methods from the code generator. Returns a component at the specified index. You can only get a component at an index if it exists. The prefered way is to use the generated methods from the code generator. Returns all added components. Returns all indices of added components. Determines whether this entity has a component at the specified index. Determines whether this entity has components at all the specified indices. Determines whether this entity has a component at any of the specified indices. Removes all components. Returns the componentPool for the specified component index. componentPools is set by the context which created the entity and is used to reuse removed components. Removed components will be pushed to the componentPool. Use entity.CreateComponent(index, type) to get a new or reusable component from the componentPool. Returns a new or reusable component from the componentPool for the specified component index. Returns a new or reusable component from the componentPool for the specified component index. Returns the number of objects that retain this entity. Retains the entity. An owner can only retain the same entity once. Retain/Release is part of AERC (Automatic Entity Reference Counting) and is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point. Releases the entity. An owner can only release an entity if it retains it. Retain/Release is part of AERC (Automatic Entity Reference Counting) and is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point. Returns a cached string to describe the entity with the following format: Entity_{creationIndex}(*{retainCount})({list of components}) Use context.GetGroup(matcher) to get a group of entities which match the specified matcher. Calling context.GetGroup(matcher) with the same matcher will always return the same instance of the group. The created group is managed by the context and will always be up to date. It will automatically add entities that match the matcher or remove entities as soon as they don't match the matcher anymore. Occurs when an entity gets added. Occurs when an entity gets removed. Occurs when a component of an entity in the group gets replaced. Returns the number of entities in the group. Returns the matcher which was used to create this group. Use context.GetGroup(matcher) to get a group of entities which match the specified matcher. This is used by the context to manage the group. This is used by the context to manage the group. This is used by the context to manage the group. Removes all event handlers from this group. Keep in mind that this will break reactive systems and entity indices which rely on this group. Determines whether this group has the specified entity. Returns all entities which are currently in this group. Fills the buffer with all entities which are currently in this group. Returns the only entity in this group. It will return null if the group is empty. It will throw an exception if the group has more than one entity. A context manages the lifecycle of entities and groups. You can create and destroy entities and get groups of entities. The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext(); Occurs when an entity gets created. Occurs when an entity will be destroyed. Occurs when an entity got destroyed. Occurs when a group gets created for the first time. The total amount of components an entity can possibly have. This value is generated by the code generator, e.g ComponentLookup.TotalComponents. Returns all componentPools. componentPools is used to reuse removed components. Removed components will be pushed to the componentPool. Use entity.CreateComponent(index, type) to get a new or reusable component from the componentPool. The contextInfo contains information about the context. It's used to provide better error messages. Returns the number of entities in the context. Returns the number of entities in the internal ObjectPool for entities which can be reused. Returns the number of entities that are currently retained by other objects (e.g. Group, Collector, ReactiveSystem). The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext(); The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext(); Creates a new entity or gets a reusable entity from the internal ObjectPool for entities. Destroys all entities in the context. Throws an exception if there are still retained entities. Determines whether the context has the specified entity. Returns all entities which are currently in the context. Returns a group for the specified matcher. Calling context.GetGroup(matcher) with the same matcher will always return the same instance of the group. Adds the IEntityIndex for the specified name. There can only be one IEntityIndex per name. Gets the IEntityIndex for the specified name. Resets the creationIndex back to 0. Clears the componentPool at the specified index. Clears all componentPools. Resets the context (destroys all entities and resets creationIndex back to 0). Removes all event handlers OnEntityCreated, OnEntityWillBeDestroyed, OnEntityDestroyed and OnGroupCreated A JobSystem calls Execute(entities) with subsets of entities and distributes the workload over the specified amount of threads. Don't use the generated methods like AddXyz() and ReplaceXyz() when writing multi-threaded code in Entitas. Systems provide a convenient way to group systems. You can add IInitializeSystem, IExecuteSystem, ICleanupSystem, ITearDownSystem, ReactiveSystem and other nested Systems instances. All systems will be initialized and executed based on the order you added them. Creates a new Systems instance. Adds the system instance to the systems list. Calls Initialize() on all IInitializeSystem and other nested Systems instances in the order you added them. Calls Execute() on all IExecuteSystem and other nested Systems instances in the order you added them. Calls Cleanup() on all ICleanupSystem and other nested Systems instances in the order you added them. Calls TearDown() on all ITearDownSystem and other nested Systems instances in the order you added them. Activates all ReactiveSystems in the systems list. Deactivates all ReactiveSystems in the systems list. This will also clear all ReactiveSystems. This is useful when you want to soft-restart your application and want to reuse your existing system instances. Clears all ReactiveSystems in the systems list. A ReactiveSystem calls Execute(entities) if there were changes based on the specified Collector and will only pass in changed entities. A common use-case is to react to changes, e.g. a change of the position of an entity to update the gameObject.transform.position of the related gameObject. Specify the collector that will trigger the ReactiveSystem. This will exclude all entities which don't pass the filter. Activates the ReactiveSystem and starts observing changes based on the specified Collector. ReactiveSystem are activated by default. Deactivates the ReactiveSystem. No changes will be tracked while deactivated. This will also clear the ReactiveSystem. ReactiveSystem are activated by default. Clears all accumulated changes. Will call Execute(entities) with changed entities if there are any. Otherwise it will not call Execute(entities). Returns all entities matching the specified matcher. Creates a new entity and adds copies of all specified components to it. If replaceExisting is true it will replace exisintg components. Creates a Collector for this group. A Collector can observe one or more groups from the same context and collects changed entities based on the specified groupEvent. Returns all collected entities. Call collector.ClearCollectedEntities() once you processed all entities. Returns the number of all collected entities. Creates a Collector and will collect changed entities based on the specified groupEvent. Creates a Collector and will collect changed entities based on the specified groupEvents. Activates the Collector and will start collecting changed entities. Collectors are activated by default. Deactivates the Collector. This will also clear all collected entities. Collectors are activated by default. Returns all collected entities and casts them. Call collector.ClearCollectedEntities() once you processed all entities. Clears all collected entities. Returns the only entity in the collection. It will throw an exception if the collection doesn't have exactly one entity. Returns the only entity in the collection. It will throw an exception if the collection doesn't have exactly one entity. Adds copies of all specified components to the target entity. If replaceExisting is true it will replace exisintg components. Automatic Entity Reference Counting (AERC) is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point. UnsafeAERC doesn't check if the entity has already been retained or released. It's faster, but you lose the information about the owners. Automatic Entity Reference Counting (AERC) is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point. SafeAERC checks if the entity has already been retained or released. It's slower, but you keep the information about the owners. Base exception used by Entitas. Implement this interface if you want to create a component which you can add to an entity. Optionally, you can add these attributes: [Unique]: the code generator will generate additional methods for the context to ensure that only one entity with this component exists. E.g. context.isAnimating = true or context.SetResources(); [MyContextName, MyOtherContextName]: You can make this component to be available only in the specified contexts. The code generator can generate these attributes for you. More available Attributes can be found in Entitas.CodeGeneration.Attributes/Attributes. Implement this interface if you want to create a system which should execute cleanup logic after execution. Implement this interface if you want to create a system which should be executed every frame. Implement this interface if you want to create a system which should be initialized once in the beginning. This is the base interface for all systems. It's not meant to be implemented. Use IInitializeSystem, IExecuteSystem, ICleanupSystem or ITearDownSystem. Implement this interface if you want to create a system which should tear down once in the end. Creates a Collector. Creates a Collector. A ReactiveSystem calls Execute(entities) if there were changes based on the specified Collector and will only pass in changed entities. A common use-case is to react to changes, e.g. a change of the position of an entity to update the gameObject.transform.position of the related gameObject. Specify the collector that will trigger the ReactiveSystem. This will exclude all entities which don't pass the filter. Activates the ReactiveSystem and starts observing changes based on the specified Collector. ReactiveSystem are activated by default. Deactivates the ReactiveSystem. No changes will be tracked while deactivated. This will also clear the ReactiveSystem. ReactiveSystem are activated by default. Clears all accumulated changes. Will call Execute(entities) with changed entities if there are any. Otherwise it will not call Execute(entities).