Skip to main content

Number

This node stores and manages a numeric value.

The Number node holds a number that can be updated, read, and monitored for changes.

The Number node is a variable container for numeric data. It stores a number (integer or float) and provides mechanisms to update it either immediately or upon a signal trigger.

Inputs

General

DataDescription
ValueThe number to store. Default: 0.

Actions

SignalDescription
SetTriggers the update of the stored value. If connected, the Value input is buffered until this signal is received.

Outputs

Data

DataDescription
ValueThe currently stored numeric value.

Signals

SignalDescription
ChangedTriggered whenever the stored value changes (i.e., new value is different from old value).
StoredTriggered when the Set action is completed, regardless of whether the value changed.

Usage

Use the Number node to store scores, counters, coordinates, or any other numeric state.

Modes of Operation

  1. Direct Update (Default):
    • Leave the Set input disconnected.
    • Any change to the Value input immediately updates the stored value and triggers the Changed signal.
  2. Explicit Update (Buffered):
    • Connect a signal to the Set input.
    • Changes to the Value input are "buffered" internally.
    • The stored value only updates (and outputs change) when the Set signal is triggered.

Example Use Cases

  1. Score Keeping: Store the current player score.
  2. Settings: Store a volume level or brightness setting.
  3. Counters: Use with math nodes to create a counter (Current Value + 1 -> New Value).

Detailed Behavior

  • Type Casting: Any input provided to Value is automatically converted to a number (Number(value)). Non-numeric strings will result in NaN.
  • Change Detection: The Changed signal only fires if the new value is strictly different from the current value.
  • Stored Signal: The Stored signal fires every time Set is triggered, even if the value remains the same.

Troubleshooting

  • Value Not Updating: If you have connected a wire to the Set input, the node enters "Explicit Update" mode. You must trigger the Set signal for the value to update.
  • NaN Result: If you pass a non-numeric string (like "hello") to the input, the value will become NaN (Not a Number).