EasyEcs
API reference

ComponentSet

A set of component types, built once and kept (a static readonly field)…

public readonly struct 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. ComponentSet.Create().With<Bank>().With<Deposits>(); a framework that learns its types at registration adds them by Type. Each call returns a new set.

Methods

Contains

public bool Contains<T>() where T : struct, IComponent;

Whether the set holds T. O(1).

Create

public static ComponentSet Create();

The empty set: the start of a chain. O(1).

With

public ComponentSet With(Type type);

This set and component type type (a struct implementing IComponent). Cold: one lookup.

Exceptions

  • ArgumentException: type is not a component type the generator or a world registered.

With

public ComponentSet With<T>() where T : struct, IComponent;

This set and T. O(1).

Edit on GitHub

Last updated on

How is this guide?

On this page