Node signals
Node signals (node.signals) are the shared channel that decouples components, scripts and modules. Every node has its own signal space; providers supply data and listeners only read it.
Read and write
ts
const signals = scene.get("Player")!.signals;
// Write: update a provider field
signals.set("platformer2d", "Speed", 240);
// Strict, typed reads (no implicit conversion)
const speed = signals.getNumber("platformer2d", "Speed", 180);
const grounded = signals.getBoolean("platformer2d", "Grounded", false);
// Batch read
const snapshot = signals.snapshot("platformer2d");get(name, key)returnsSignalValue | undefined.getNumber/getInteger/getBoolean/getStringaccept a fallback and return it on type mismatch instead of converting.describe()returns field metadata (type, read-only, source) for debug panels.
Listening
ts
const dispose = signals.watchNumber(
"platformer2d",
"Speed",
(value) => {
console.log("speed changed", value);
},
);
// On unmount
dispose();watch(name, key, handler, options?)fires only when the dispatched payload contains thatkey.immediatedefaults totrue: the handler runs once with the current value at registration.- Typed variants validate the value type and skip invalid values.
on(name, handler)/onAny(handler)listen to a whole channel (including event keys).
Events and $refresh
A signal name is also an event channel. Emitting { $refresh: true } on your own signal name means "data changed, read it again":
ts
// Data side: tell listeners to re-read
signals.emitRefresh("platformer2d");
// Listener side: apply the refreshed value
signals.watchNumber("platformer2d", "Speed", (value) => apply(value));emitRefresh(name) is dispatch(name, { $refresh: true }): it notifies listeners without writing the provider. Details:
- Field events use the value in the payload.
- With only
$refresh,watch*re-reads the provider throughget(name, key). - If a payload carries both a field and
$refresh, the field wins and the handler fires once. - Unchanged values still notify — a refresh is explicit.
Registering a provider
Modules and scripts can register providers:
ts
const dispose = this.signals.registerSignalProvider({
name: "health",
get(key) {
return key === "Hp" ? this.hp : undefined;
},
set(key, value) {
if (key === "Hp") this.hp = Number(value);
},
describe() {
return [{ key: "Hp", type: "number" }];
},
});
// Shorthand
this.signals.provideSignal("health", { Hp: this.hp });- Multiple providers may live on one node; names match exactly and
*is the only wildcard. - Empty names are forbidden; a later provider with the same name replaces the earlier one.
- Provider data must be JSON-safe.
- Unmounting a script/component releases its providers and listeners (
ScriptSignalsScopetracks disposers).
Debugging
The Play Signals tab has three views:
- Signals: current values per provider, with type, read-only state and listener count;
- Listeners: every listening channel, including
datachannels without a provider and declared event names; - Dispatch: per-signal
get/set/listenerstats to find silently dropped or rejected values.
The public API is describeEntries / describeListeners / getRecentSignals and getSignalStats; see the Runtime API.
