Skip to content
Ehsan Rashidi edited this page Oct 27, 2025 · 1 revision

ECS – Systems

Systems are responsible for processing entities and reacting to state changes.
They encapsulate logic, control execution order, and optimize updates within the ECS architecture.

ECSSystem

The base class for all ECS systems.

Properties

  • interactsWith – The set of entity types this system will interact with (trigger events or update components).

Methods

  • log(String message, {ECSLogLevel level}) (protected) – Log messages via the feature’s manager.
  • getEntity<TEntity extends ECSEntity>() (protected) – Retrieve an entity of a specific type, checking cache, feature, and manager in order.

InitializeSystem

Systems that perform setup tasks before execution.

Methods

  • initialize() – Override to implement initialization logic.

Notes

  • Called once after the first frame and before other systems.

ExecuteSystem

Systems that perform periodic tasks during execution.

Properties

  • executesIf – Determines whether the system should execute on each frame.

Methods

  • execute(Duration elapsed) – Override to implement recurring logic.

Notes

  • Called every frame if executesIf is true.

CleanupSystem

Systems that perform cleanup tasks after execution.

Properties

  • cleansIf – Determines whether cleanup should be executed on this frame.

Methods

  • cleanup() – Override to implement cleanup logic.

Notes

  • Executed after all ExecuteSystems and before the next frame.

TeardownSystem

Systems that perform final teardown tasks.

Methods

  • teardown() – Override to implement teardown logic.

Notes

  • Called once after the last frame and before disposing the application.

ReactiveSystem

Systems that react to entity changes.

Properties

  • reactsTo – The set of entity types this system reacts to (event triggers or component updates).
  • reactsIf – Whether the system reacts when an entity changes.

Methods

  • react() – Override to implement reaction logic.

Notes

  • Reactive systems are event-driven.
  • Optimize by specifying reactsTo to only track relevant entities and reactsIf.

Clone this wiki locally