API reference
API reference
Every public type of EasyEcs.Core with its members, generated from the XML documentation.
Everything is in namespace EasyEcs. These pages are generated from the XML documentation of EasyEcs.Core; the members the generator writes for your own components (entity.Position, world.Clock, SetDead()) are in Entities and components, and the complexity of every call in API and complexity.
Classes
| Type | Summary |
|---|---|
ChangedAttribute<T> | The ForEachAttribute method visits only entities whose T was written since its system last ran (EcsSystem.LastRunTick; on the first run, every entity having it). |
DynamicBufferExtensions | The writes of a DynamicBuffer. |
EcsSystem | Logic that runs on a world. |
ForEachAttribute | Runs a method of an EcsSystem (or a static method of any other type, through a generated entry point) for every entity matching its component parameters (and the WithAttribute / WithoutAttribute / WithAnyAttribute filters), each update, after EcsSystem.OnUpdate, in declaration order. |
OrderedIndexExtensions | Ordered walks of a value index whose key is comparable (a score, a deadline, a level): ranges and sorted iteration for leaderboards, timers and matchmaking brackets. |
Prefab | A recipe for entities: a set of component values that belongs to no world, so no query ever sees it. |
RelationIndex<T> | The links of relation T in one world, by target (World.Relations): which entities link to an entity, O(1) to start and O(1) per link. |
RemovedAttribute<T> | The ForEachAttribute method visits only entities that lost T since its system last ran (EcsSystem.LastRunTick) and have not got it back: replication sends the removal, a cleanup releases what the component stood for. |
TargetRules | Target policies of components that point at an entity (IIndexed of EntityId). |
UpdateAfterAttribute<TSystem> | Run this system after TSystem (and systems derived from it) of the same group: see UpdateBeforeAttribute. |
UpdateBeforeAttribute<TSystem> | Run this system before TSystem (and systems derived from it) of the same group, whatever their registration order. |
UpdateInGroupAttribute<TGroup> | Puts the system (and derived systems) into group TGroup. |
ValueIndex<T, TKey> | The value index of component T in one world (World.Index). |
WithAnyAttribute<T> | The ForEachAttribute method requires at least one of the components named by its [WithAny<T>] attributes (not passed in): [ForEach, WithAny<Burning>, WithAny<Poisoned>]. |
WithAttribute<T> | The ForEachAttribute method also requires component T (not passed in). |
WithoutAttribute<T> | The ForEachAttribute method skips entities having component T. |
World | An ECS world: entities, their components, singletons and the systems that update them. |
WorldOptions | Configuration of a World. |
WorldSnapshot | A copy of a world's entities, components and singletons, taken by World.Capture and put back by World.Restore (systems and options are not part of it). |
Structs
| Type | Summary |
|---|---|
ChildOf | The hierarchy relation: the entity is a child of ChildOf.Parent. |
ColumnInfo | A column of a table (TableInfo). |
ComponentSet | A set of component types, built once and kept (a static readonly field): the components a save writes (World.SaveEntities), the record of what persists without the runtime state around it. |
ComponentValue | A component of an entity, as Entity.Describe reads it: a boxed copy of its value. |
Destroyed | Tag of an entity that was destroyed while holding ICleanupComponents: its other components are gone, it stays alive until its last cleanup component is removed. |
Disabled<T> | The tag of an entity whose T is disabled (Entity.Disable): the entity keeps the value of T but lacks it for queries, Has and Get until Entity.Enable gives it back. |
DynamicBuffer<T> | A list of T per entity, held as a component: an inventory, a path, the hits of this tick. |
Entity | Handle to an entity: id + version + world (16 bytes). |
EntityId | The identity of an entity: its index and the incarnation of that index (8 bytes, unmanaged). |
EntitySpan | The entities of one run of rows in a batch job: element i is the entity whose components are element i of the run's spans. |
Maybe<T> | An optional component of the entity a [ForEach] method visits: static void Regen(ref Health h, Maybe<Buff> buff) visits every entity with Health, and Maybe.HasValue tells whether this one also has a Buff. |
QueryEnumerator<T1..T9> | Allocation-free query enumerator; safe under structural changes during iteration (same visiting rules as ForEach). |
QueryFilter | Extra query constraints: components that must be present without being read (QueryFilter.With) or must be absent (QueryFilter.Without). |
QueryItem<T1..T9> | One query result: the entity and refs into its row. |
RelationIndex<T>.Sources | Enumerates the entities linking to one target (foreach), once per link. |
SingletonRef<T> | Handle to one world's singleton T. |
SystemAccess | The data a system reads and writes, declared once when the system is added. |
SystemList | The systems of a world, every group in execution order (default group first): foreach it, or read SystemList.Count. |
SystemList.Enumerator | Walks the groups and their systems. |
SystemStats | How often and how long a system ran (WorldOptions.MeasureSystems): EcsSystem.OnUpdate plus its [ForEach] methods, per run. |
TableInfo | A table: the entities with one set of component columns (World.Describe). |
ValueIndex<T, TKey>.Matches | Enumerates the entities of one key (foreach). |
ValueIndex<T, TKey>.Ordered | Enumerates entities in key order (foreach): every entity of a key, then the next key. |
World.DescendantWalk | A depth-first walk of World.Descendants: a stack of the child lists still being read, given back to the world by World.DescendantWalk.Dispose (foreach calls it). |
World.EntityEnumerator | Enumerates alive entities in id order; ids beyond the capacity captured at start are not visited. |
World.Subtree | The descendants of an entity (World.Descendants): each foreach walks them anew. |
Interfaces
| Type | Summary |
|---|---|
ICleanupComponent | Marks a component that outlives the destruction of its entity: destroying an entity holding one removes its other components and adds the Destroyed tag instead of freeing it, so a system can release what the component stands for (a socket, a reservation, a slot in another service) and then remove it. |
IComponent | Marks a struct as component data. |
IForEach<T1..T9> | Struct callback for World.ForEach. |
IForEachBatch<T1..T9> | Struct callback for World.ForEachBatch: receives whole runs of rows as spans, one per component, so the job can process them with SIMD (System.Numerics.Vector, MemoryMarshal.Cast), and their entities (built only when indexed). |
IForEachEntity<T1..T9> | Like IForEach but also receives the Entity handle, built from the archetype's entity rows (id and version side by side) without a per-entity lookup. |
IGroup | Marks a component whose value splits tables: in a world that called World.GroupBy, entities with different IGroup.Groups live in different tables, so a query of one group (QueryFilter.InGroup) walks only its own rows, contiguous in memory (a zone, a map, a match, a team). |
IGroupWith<T> | A system group whose [ForEach] methods visit only entities with T, as WithAttribute on the group would. |
IGroupWithout<T> | A system group whose [ForEach] methods skip entities with T, as WithoutAttribute on the group would (see IGroupWith). |
IIndexed, IIndexed<TKey> | What every IIndexed is, so a component type is known to be indexed without reflection (a type test the JIT folds). |
INoStructuralChanges | Marks a ForEach job that makes no structural change (no create/destroy/add/remove/set on any entity of the world it iterates). |
IRelation | An element of a DynamicBuffer that links its entity to IRelation.Target: an entity holds any number of links of one kind (the members of a party, the items a merchant offers, the units a buff applies to), and World.Relations finds the entities linking to a target. |
ISingletonComponent | Marks a struct as a world singleton: exactly one value per world (clock, configuration, shared state). |
ISystemGroup | Marker of a system group: systems marked UpdateInGroupAttribute run together when World.Update is called, independently of the default group run by World.Update. |
ITrackChanges | Marks a component whose changes are tracked: every row records the world's World.ChangeTick of its last write, and [Changed<T>] / QueryFilter.Changed<T>(since) select the rows written since a system last ran. |
Enums
| Type | Summary |
|---|---|
SystemErrorPolicy | What an exception thrown by a system does (WorldOptions.SystemErrors). |
TargetPolicy | What happens to the links to an entity when it is destroyed (TargetRules.WhenTargetDestroyed, RelationIndex.WhenTargetDestroyed). |
Delegates
| Type | Summary |
|---|---|
EntityIdField<T> | An EntityId field of value (see SavedTypes.EntityIds). |
Edit on GitHub
Last updated on
How is this guide?
API and complexity
Every public type and call of EasyEcs on one page, grouped by task, with its time complexity and allocations. The member reference comes from the XML docs.
ChangedAttribute<T>
The ForEachAttribute method visits only entities whose T was written since its system last ran (EcsSystem.LastRunTick…