Skip to content
Bit Quirky Round Trip
Visual Scripting

Search documentation

All topics and APIs

Close returns focus to Search.

What are you looking for?

Try a common topic or a C# feature.

Browse the reference instead

Esc closes · Tab reaches results · Enter opens the focused link

v1.0.0
Menu

Fields and defaults

Add a value the class keeps, pick its type, expose it in the Inspector, and give it a starting value.

A value the class keeps between frames, such as a speed a designer tunes or a count the game tracks, lives in a variable. You add it from the Variables list in the left rail and set it up in the right rail.

Each variable is one row in the Variables list, showing its name and type beside a dot in its type color. Selecting the row fills the right rail with everything about it: whether it is Shown in the Inspector, who can read it, its type, its Inspector labels, and its Default card, which holds the value it starts with. When you change one variable, the others keep their order and their labels. Their notes stay too. Every variable you add becomes a pill you can drag onto any method canvas in the class.

Properties that simply expose storage also belong under Variables. A property with behavior in its getter or setter appears under Methods instead. Properties: Variables or Methods? shows the difference and explains why a backing field may still have its own row.

Add a variable when the class needs to remember something or a designer needs to tune it: the player’s move speed and jump force, the number of coins that opens the door, a reference to the Rigidbody2D on the same object, whether a coin has already been collected. Give it a starting value when it should begin at something other than zero or empty, such as a move speed of 8.

The Default card tells you where the starting value came from. From your code means Round Trip found a starting value already in the script. Implicit means the variable has none and starts at C#’s default for its type. Edited · draft means you have changed it and not yet pressed Compile.

The Variables rail for PlayerController
Figure 1. The Variables list with its + in the header. Each row shows the name and type beside a type-color dot. A row whose starting value can be opened as a diagram has a DEFAULT row under it.

Add a variable and give it a starting value

  1. Pick the class

    Pick the class in the class picker at the top left of the Round Trip graphs window so its Variables list fills the left rail.

    The Round Trip graphs window with FieldExamples selected in the class picker, which is highlighted at the top left with an arrow pointing at it. Its Variables list fills the left rail and counts 4: gravityScale and jumpForce plus the Rigidbody property under PUBLIC, BaseJumpForce under PRIVATE. Inherited members sit under their own INHERITED heading and are not counted. The canvas reads Select a method to view the graph and the right rail shows the class panel.
  2. Add a variable and name it

    Press + on the Variables header (tooltip Add a variable to this class.). A new row appears with its name ready to type. Type the name, such as moveSpeed, and press Enter.

    A new row reading moveSpeed, marked new, under PRIVATE in the Variables list, whose count now reads 5. The + on the Variables header and the new row are highlighted, with an arrow pointing at the +. The right rail has switched to the new variable's panel, headed moveSpeed with variable · int beneath, a VARIABLE COMMENT slot, and Property and Constant switched off in its Declaration card above a Remove variable link, and a Previewing your changes banner reads 1 declaration isn't in the C# yet.
  3. Choose its type

    Click the type under Declaration in the right rail to open the type chooser, then pick float. Type in the search box to narrow the list.

    The type chooser open under moveSpeed's Declaration, headed type, with most used listing Array, string, int, bool, and float. The Type control in the Declaration card is highlighted, with an arrow pointing at it.
    Clip: the type chooser, headed type. The pointer types Dictionary to search, points at Dictionary<TKey, TValue> under most used and clicks it; the heading becomes Dictionary<string, TValue>. It points at string and clicks it, then points at int and clicks it; the heading reads Dictionary<string, int> and the chooser closes.
  4. Turn on Shown in the Inspector

    In the right rail, turn on Shown in the Inspector if a designer should tune it.

    moveSpeed's EXPOSURE toggle on, highlighted with an arrow pointing at it, captioned Saved with the object, designers tune it without touching code; ACCESS stays private with a new [SerializeField] attribute.
    The Rigidbody property selected: its Storage card reads From your code, a read-only property, with BACKING the serialized _rigidbody field, GETTER a straight pass-through, and ACCESS read-only.
  5. Type a starting value

    Find the Default card in the right rail and type a value such as 8 into its VALUE row.

    The right rail scrolled so moveSpeed's Default card shows its KIND and its VALUE row, which reads 8. The VALUE row is highlighted with an arrow pointing at it, and the card's badge reads From your code.
  6. Edit an existing default live

    Select a variable that already has a starting value, such as gravityScale, and change the number right on its Default card. Reset to recognized puts the value from your code back.

    gravityScale selected in the Variables list and its Default card edited to 3, both highlighted with arrows pointing at them: the DEFAULT badge reads Edited draft under Now starts as 3.
  7. Open a worked-out default as nodes

    If the starting value is worked out from other values rather than typed, a DEFAULT row appears under the variable in the left rail. Click its chip (tooltip Open default graph) to see the value as nodes on a canvas. Click Rail to go back and make changes.

    jumpForce's DEFAULT child graph open on the canvas: a CUSTOM INITIALIZER node wired through an Abs call into the jumpForce EXIT node, top bar reading FieldExamples, jumpForce, default value, READ-ONLY V1, with Rail and View source. The chip on the DEFAULT row and the Rail button are highlighted, with an arrow pointing at the chip.
  8. Compile

    Press Compile in the toolbar.

    The window with moveSpeed still a draft: the Compile button in the toolbar is lit and highlighted with an arrow pointing at it, and so is the Compile button in the Previewing your changes panel.
    After Compile: moveSpeed lists as float = 8 under PRIVATE with no new badge, and its Default card reloads reading From your code; both are highlighted, with arrows pointing at them. The Previewing your changes banner is gone and the grey Compile button in the toolbar shows nothing is waiting.

If you also work in C#, this is what is written into the script. These declarations are drafted on Enemy in the Platformer sample, with typed starting values and Inspector labels:

A new variable is written after the class’s last field, in the file’s own spacing. Changing a starting value replaces only that one declaration.

When it goes wrong

SymptomCheckFix
Compile is offSelect the new variable and look for a message in the right rail: a value that is not a valid number, a missing name, or a missing type.Fix the variable it names, then Compile.
Create Set Node is grayed out for a propertyRead the Storage card in the right rail.Write the field that stores the value, or give the property a setter as a separate change.
The default-value canvas will not let you editLook for READ-ONLY · V1 in the top bar.Press Rail and edit the default in the right rail.
Full-size image