Class Archetype<TSelf>
CRTP base class for ECS archetypes. Concrete archetypes inherit from this and declare components
as static readonly Comp<T> fields via Register<T>().
public abstract class Archetype<TSelf> where TSelf : Archetype<TSelf>
Type Parameters
TSelfThe concrete archetype type (CRTP pattern).
- Inheritance
-
Archetype<TSelf>
- Derived
- Inherited Members
Remarks
Finalization (slot assignment, validation, metadata creation) is lazy — triggered on first access to Typhon.Engine.Archetype`1.Metadata. This avoids static constructor ordering issues between the base class and derived class field initializers.
Constructors
Archetype()
protected Archetype()
Methods
Register<T>()
Declare a component for this archetype. Must be called as a static field initializer.
protected static Comp<T> Register<T>() where T : unmanaged
Returns
- Comp<T>
Type Parameters
T