Skip to content

BehaviorDef

Defined in: behavior.ts:55

S extends object

optional metadata?: ComponentMetadata

Defined in: behavior.ts:61

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


optional schedule?: Schedule

Defined in: behavior.ts:59

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


optional state?: S

Defined in: behavior.ts:57

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

optional destroy(ctx): void

Defined in: behavior.ts:67

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

BehaviorContext<S>

void


optional start(ctx): void

Defined in: behavior.ts:63

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:65

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

BehaviorContext<S>

number

void