EasyEcs
API reference

EcsSystem

Logic that runs on a world. The EcsSystem class of EasyEcs, the C# ECS: its members, parameters and complexity.

public abstract class EcsSystem

Logic that runs on a world. Lifecycle: EcsSystem.OnCreate when added, then every update EcsSystem.OnUpdate followed by the [ForEach] methods, and EcsSystem.OnDestroy when removed or when the world is disposed. Everything runs synchronously within World.Update (or World.Update for systems in a group): on the calling thread, or with WorldOptions.ParallelSystems on a thread-pool thread next to systems whose access does not conflict.

Constructors

EcsSystem

protected EcsSystem();

Properties

Enabled

public bool Enabled { get; set; }

Disabled systems are skipped by World.Update and World.Update. Enabling a system clears its EcsSystem.Error.

Error

public Exception Error { get; }

The exception that switched this system off under SystemErrorPolicy.Disable, until it is enabled again; null otherwise.

LastRunTick

public ulong LastRunTick { get; }

The world's World.ChangeTick when this system last ran (0 before its first run): its [Changed<T>] methods select rows written after that tick, so not their own writes of that run.

Stats

public SystemStats Stats { get; }

Run count and time of this system; recorded only with WorldOptions.MeasureSystems.

UpdateInterval

public virtual int UpdateInterval { get; }

Run every N-th world update (1 = every update); see EcsSystem.UpdatePhase.

UpdatePhase

public virtual int UpdatePhase { get; }

Which of the EcsSystem.UpdateInterval updates the system runs on (0 to interval - 1): systems with the same interval and different phases spread their work over the updates instead of all running on the same one.

World

public World World { get; }

The world this system belongs to (set before EcsSystem.OnCreate).

Methods

OnCreate

protected virtual void OnCreate();

Called once when the system is added to a world.

OnDestroy

protected virtual void OnDestroy();

Called once when the system is removed or the world is disposed.

OnUpdate

protected virtual void OnUpdate();

Called every update before the system's [ForEach] methods.

Edit on GitHub

Last updated on

How is this guide?

On this page