Add a query definition to the system
Exclude this system from running in specified screens. System will be skipped during update() when the current screen is in this list.
Array of screen names where this system should NOT run
This SystemBuilder instance for method chaining
Add this system to a group. Systems can belong to multiple groups. When any group a system belongs to is disabled, the system will be skipped.
The name of the group to add the system to
This SystemBuilder instance for method chaining
Set the execution phase for this system. Systems are grouped by phase and executed in order: preUpdate -> fixedUpdate -> update -> postUpdate -> render
The phase to assign this system to (default: 'update')
This SystemBuilder instance for method chaining
Restrict this system to only run in specified screens. System will be skipped during update() when the current screen is not in this list.
Array of screen names where this system should run
This SystemBuilder instance for method chaining
Require specific assets to be loaded for this system to run. System will be skipped during update() if any required asset is not loaded.
Array of asset keys that must be loaded
This SystemBuilder instance for method chaining
Allow this system to run even when all queries return zero entities. By default, systems with queries are skipped when no entities match.
Set event handlers for the system These handlers will be automatically subscribed when the system is attached
This SystemBuilder instance for method chaining
Set the onDetach lifecycle hook Called when the system is removed from the ECS
Function to run when this system is detached from the ECS
This SystemBuilder instance for method chaining
Register a callback that fires once per entity the first time it appears in a query's results. Fires before process. Automatic cleanup when entity leaves the query so re-entry fires the callback again.
Name of a query previously added via addQuery
Function called with the entity and ecs instance
This SystemBuilder instance for method chaining
Set the onInitialize lifecycle hook Called when the system is initialized via ECSpresso.initialize() method
Function to run when this system is initialized
This SystemBuilder instance for method chaining
Set the priority of this system. Systems with higher priority values execute before those with lower values. Systems with the same priority execute in the order they were registered.
The priority value (default: 0)
This SystemBuilder instance for method chaining
Set the system's process function that runs each update. The callback receives a single context object { queries, dt, ecs, resources? }. The context is pre-allocated per system and reused every frame.
Function to process entities matching the system's queries each update
This SystemBuilder instance for method chaining
Declare resource dependencies for this system. Resources are resolved once (on first process call) and the same object is reused every frame. The resolved resources are available as ctx.resources in setProcess.
Array of resource keys to resolve
This SystemBuilder instance for method chaining
Builder class for creating type-safe ECS Systems with proper query inference. Systems are automatically registered with their ECSpresso instance when finalized (at the start of initialize() or update()).