Struct Entity
Namespace: KenseiECS
Lightweight entity identifier (8 bytes). Contains slot index and generation as separate ints. Generation is used to detect stale references: when a slot is reused, generation increments, making all old Entity values with the previous generation invalid.
public readonly struct Entity : IEquatable<Entity>Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Fields
Generation
Slot generation — increments each time a slot is reused.
public readonly int GenerationField Value
Index
Slot index in World entity arrays.
public readonly int IndexField Value
Null
Invalid entity — default(Entity) = (0, 0), never matches a real entity (generations start at 1).
public static readonly Entity NullField Value
Methods
Equals(Entity)
True when both index and generation match.
public bool Equals(Entity other)Parameters
other Entity
Returns
Equals(object)
True when obj is an Entity with the same index and generation.
public override bool Equals(object obj)Parameters
obj object
Returns
GetHashCode()
Hash combining index and generation.
public override int GetHashCode()Returns
ToString()
Formats as index and generation, e.g. E(5v2).
public override string ToString()Returns
Operators
operator ==(Entity, Entity)
True when both index and generation match.
public static bool operator ==(Entity a, Entity b)Parameters
a Entity
b Entity
Returns
operator !=(Entity, Entity)
True when index or generation differ.
public static bool operator !=(Entity a, Entity b)Parameters
a Entity
b Entity
