Using Live Variables

Once you've created a Live Variable, you can use it anywhere in Scriptum.
This includes:
- REPL Mode
- Editor Mode
- Quick Spells
- Live Spells
- Inside evaluated results like
echo()
ormanifest()
Live Variables give you instant access to runtime objects without needing to declare or track them manually. They remain available throughout your session.
Binding via Drag and Drop
You can bind variables visually by simply dragging:
- From the Hierarchy, Project, Inspector, or Scene
- And dropping directly into the Scriptum REPL Console or Editor Window
Scriptum will show a visual drop zone indicator when a valid drop target is active. After dropping, you’ll be prompted to name the variable, or Scriptum will assign one automatically.
Dragging from the Scene requires the Scene Drag Mode to be enabled.
There’s a small toggle button on the top-right of the Scriptum Console window. Use it to turn Scene Dragging on or off. - When on, you can drag GameObjects directly from the Scene view. - When off, normal Scene manipulation (moving objects) is restored.
Binding from Code
Use bind()
to create a Live Variable directly from a value:
You can also rename:
And remove:
Or clean everything:
Naming Tips: Avoid using special characters or spaces. Stick to clean identifiers:
✅
@player
,@enemy1
,@mainCamera
❌@My Player
,@enemy#2
,@foo.bar
Scriptum will warn you when a name is invalid or already in use.
Referencing in Code
You reference any Live Variable using the @
symbol:
This automatically pulls the value from the internal registry and injects it into the current evaluation. You can use Live Variables:
- In expressions
- As arguments
- In assignments
- Within method calls or chained access
Examples:
if (@player.isAlive)
@player.TakeDamage(25);
@mainCamera.transform.position.y
@inventory[2].UseItem()
@manager.GetComponent<AudioSource>().Play()
@
, showing all current Live Variables with type hints.