EntityId
The identity of an entity: its index and the incarnation of that index (8 bytes, unmanaged).
public readonly struct EntityId : IEquatable<EntityId>The identity of an entity: its index and the incarnation of that index (8 bytes, unmanaged). Store it wherever an entity is referred to from data (a relation, a target, an owner, a message): a component holding only unmanaged values keeps an unmanaged column, which is pinned, copied as a block and never scanned by the GC, and serializes as raw bytes. Turn it back into a handle with World.TryGetEntity; a handle converts to its id implicitly. default is EntityId.Null, which no entity has.
Constructors
EntityId
public EntityId(int index, int version);The id of entity index, incarnation version.
Fields
Index
public readonly int Index;Entity index (dense, recycled after destruction).
Version
public readonly int Version;Incarnation of EntityId.Index; starts at 1 and grows each time an entity with the index is destroyed.
Properties
IsNull
public bool IsNull { get; }Whether this is EntityId.Null.
Null
public static EntityId Null { get; }The id no entity has (default): an empty reference.
Methods
Equals
public bool Equals(EntityId other);
public override bool Equals(object obj);GetHashCode
public override int GetHashCode();ToString
public override string ToString();Operators
operator !=
public static bool operator !=(EntityId left, EntityId right);Different ids name different entities or incarnations.
operator ==
public static bool operator ==(EntityId left, EntityId right);Equal ids name the same incarnation of the same entity.
Last updated on
How is this guide?
Entity
Handle to an entity: id + version + world (16 bytes). The Entity struct of EasyEcs, the C# ECS: its members, parameters and complexity.
EntityIdField<T>
An EntityId field of value (see SavedTypes.EntityIds). The EntityIdField<T> delegate of EasyEcs, the C# ECS: its members, parameters and complexity.