Variable node
Set Variable
Writes a value to a variable when Set is true. Variables are global data containers that allow nodes to share data without cables. The written value becomes instantly available to all Get Variable nodes reading the same variable.
Inputs
| Port | Type | Default |
|---|---|---|
| ValueThe value written into the variable. It is converted to the variable's declared type, so a float arriving at an integer variable is truncated. For an image variable this captures the source, not the pixels. | any | — |
| SetThe write gate. While true the incoming value is stored every frame; while false the variable keeps what it already holds and still passes it through. | bool | false |
Outputs
| Port | Type |
|---|---|
| ValueThe value written into the variable. It is converted to the variable's declared type, so a float arriving at an integer variable is truncated. For an image variable this captures the source, not the pixels. | any |
How It Works
Set Variable writes the Value input to a named variable in the project's variable store whenever Set is true. The variable name is assigned when the node is created.
The output passes through the current variable value (whether just written or previously stored), making it possible to chain Set Variable into other processing.
If Set is false, no write occurs — the variable retains its previous value.
Use Cases
- Data broadcasting: Write a processed result to a variable so multiple distant nodes can read it without long cable runs.
- State storage: Save the current mode, scene index, or calibration value for later retrieval.
- Event-driven updates: Connect Set to a trigger (Timer Done, MIDI note, button click) to update the variable only at specific moments.
- Initialization: Write default values at startup by connecting Set to a one-shot trigger.
Tips
- Keep Set connected to a meaningful trigger — leaving it always true means the variable is written every frame, which is fine for continuously changing data but unnecessary for static values.
- Variables are typed dynamically — you can write a float, string, color, or any other type to the same variable.
- The Set Variable inspector shows the current variable name and allows renaming.
Image Variables
Set Variable can store an Image — a still, a texture, a video, or a live camera. It holds a live reference to the source (not pixels), so a stored camera or video stays live. While Set is on, the cable source is captured and flows through live; while Set is off, the cable is ignored and the variable keeps its last source (rewire and press Set to retarget). When Set turns off, a live source freezes on the current frame via a one-shot GPU snapshot — pausing video with a single copy, not a per-frame grab.
The header reads set face (action + variable name), updating on rename.
Open Set Variable in the interactive catalog →
Set Variable is one of 381 nodes in Grafit Pro.
Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.