Skip to content

BehaviorContext

Defined in: behavior.ts:34

The per-entity handle passed to a behavior’s lifecycle hooks. self is the behavior’s own component data — mutate it freely, the change persists. The object is REUSED across entities and frames (zero per-entity allocation): do not retain it past the hook call; copy what you need.

S extends object

readonly commands: CommandsInstance

Defined in: behavior.ts:44

Deferred structural ops (spawn / despawn / insert) — safe mid-iteration.


readonly entity: number

Defined in: behavior.ts:36

The entity this behavior instance is attached to.


readonly input: InputState

Defined in: behavior.ts:42

Runtime input (keyboard / mouse / touch).


readonly self: S

Defined in: behavior.ts:38

This behavior’s own component data — mutate freely (persists).


readonly time: TimeData

Defined in: behavior.ts:40

Frame timing (delta seconds, elapsed, …).


readonly world: World

Defined in: behavior.ts:46

The world, for cross-entity access.

get<C>(component): ComponentData<C>

Defined in: behavior.ts:48

Read another component on THIS entity.

C extends AnyComponentDef

C

ComponentData<C>


has(component): boolean

Defined in: behavior.ts:52

Whether THIS entity has component.

AnyComponentDef

boolean


set<C>(component, data): void

Defined in: behavior.ts:50

Write another component on THIS entity.

C extends AnyComponentDef

C

ComponentData<C>

void