Skip to content

BehaviorDef

Defined in: behavior.ts:62

S extends object

optional metadata?: ComponentMetadata

Defined in: behavior.ts:68

Field-presentation metadata for state (ranges, enums, …), forwarded to the component.


optional schedule?: Schedule

Defined in: behavior.ts:66

Schedule the lifecycle system runs in (default Schedule.Update).


optional state?: S

Defined in: behavior.ts:64

Per-entity state → a defineComponent, editable in the Details panel.


optional touches?: SystemTouches

Defined in: behavior.ts:74

The components this behaviour reaches for through ctx.get/ctx.set, by name — its own state component is already declared. Undeclared, the schedule assumes anything, and this conflicts with every other system.

optional destroy(ctx): void

Defined in: behavior.ts:80

Run once when the component is removed OR the entity is despawned.

BehaviorContext<S>

void


optional start(ctx): void

Defined in: behavior.ts:76

Run once, the frame the behavior’s component first appears on an entity.

BehaviorContext<S>

void


optional update(ctx, dt): void

Defined in: behavior.ts:78

Run every frame for each entity carrying the behavior. dt == ctx.time.delta.

BehaviorContext<S>

number

void