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.
Type Parameters
Section titled “Type Parameters”S extends object
Properties
Section titled “Properties”commands
Section titled “commands”
readonlycommands:CommandsInstance
Defined in: behavior.ts:44
Deferred structural ops (spawn / despawn / insert) — safe mid-iteration.
entity
Section titled “entity”
readonlyentity:number
Defined in: behavior.ts:36
The entity this behavior instance is attached to.
readonlyinput:InputState
Defined in: behavior.ts:42
Runtime input (keyboard / mouse / touch).
readonlyself:S
Defined in: behavior.ts:38
This behavior’s own component data — mutate freely (persists).
readonlytime:TimeData
Defined in: behavior.ts:40
Frame timing (delta seconds, elapsed, …).
readonlyworld:World
Defined in: behavior.ts:46
The world, for cross-entity access.
Methods
Section titled “Methods”get<
C>(component):ComponentData<C>
Defined in: behavior.ts:48
Read another component on THIS entity.
Type Parameters
Section titled “Type Parameters”C extends AnyComponentDef
Parameters
Section titled “Parameters”component
Section titled “component”C
Returns
Section titled “Returns”has(
component):boolean
Defined in: behavior.ts:52
Whether THIS entity has component.
Parameters
Section titled “Parameters”component
Section titled “component”Returns
Section titled “Returns”boolean
set<
C>(component,data):void
Defined in: behavior.ts:50
Write another component on THIS entity.
Type Parameters
Section titled “Type Parameters”C extends AnyComponentDef
Parameters
Section titled “Parameters”component
Section titled “component”C
Returns
Section titled “Returns”void