Skip to content

DebugRegistry

Defined in: types.ts:95

Service interface for the debug registry.

drawVector(entity, vector, options?): () => void

Defined in: types.ts:124

Draw an arrow on entity for a vector that is read fresh every frame — velocity, aim direction, knockback, steering output.

// tryResolve, not use(): use() throws without DebugPlugin installed.
const debug = this.context.tryResolve(DebugRegistryKey);
this.stopArrow = debug?.drawVector(this.entity, () => agent.velocity, {
scale: 0.35,
color: 0x4ade80,
minLength: 1,
});

The arrow starts at the entity’s world position (plus options.origin) and points along the vector. Nothing is retained but the provider itself: it is called once per frame while the overlay is on and the vectors contributor’s arrows flag is enabled, and not at all otherwise — a drawVector call in a hot path costs nothing while debug is off.

Returns a disposer that stops the drawing. Calling it twice is harmless. The registration is also dropped when the entity’s life ends — destroyed, or a pool member whose lease ended — so a provider closure never outlives the entity it draws for, and a per-lease registration never accumulates.

Entity

DebugVectorProvider

DebugVectorOptions

() => void


isEnabled(): boolean

Defined in: types.ts:97

boolean


isFlagEnabled(contributorName, flag): boolean

Defined in: types.ts:98

string

string

boolean


register(contributor): void

Defined in: types.ts:96

DebugContributor

void