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

Rename

Rename a method or variable from its name at the top of the right rail, then Compile.

Names drift. A method called HandleThing was clear when the class did one thing and becomes vague once it does five. You rename it where its name is shown, at the top of the right rail, and nothing in the script changes until you press Compile.

The method’s name at the top of the right rail is also its rename box. Press F2 there, type, then press Enter: the canvas shows the new name straight away as a draft, and the script keeps the old one until you Compile. The name is checked as you type, so a name that cannot be used tells you why before you commit it. Undo takes the rename back until you Compile.

Rename a method when its name no longer says what it does: HandleThing that now refreshes the coin display becomes RefreshCoinDisplay. Rename a variable when its meaning changes, such as speed becoming walkSpeed once the player can also run.

A method you add with the + on Methods is named when it is made. Its row opens as a name box holding NewMethod (then NewMethod1, NewMethod2), all of it selected. Enter keeps what you typed, Escape keeps the default, and an empty name, a reserved word, the class’s own name, or a name the class already has shows its reason as you type. Every later rename goes through the name at the top of the right rail.

Lifecycle methods such as Start and Update cannot be renamed: Unity finds them by name, so a new name would stop them running.

The method identity header
Figure 1. The name at the top of the right rail, here PlayerController.CollectCoin with public and void under it. Press F2 here to rename.

Rename UnlockGoal to OpenGoalWhenEarned

  1. Select the method

    Click the method’s row under Methods in the left rail.

    FlowExamples.UnlockGoal selected in the Methods list, with its row highlighted and an arrow pointing at it. Its entry node sits alone on the canvas, and the identity header at the top of the right rail reads FlowExamples.UnlockGoal.
  2. Press F2 on the name

    Click the name at the top of the right rail, or move keyboard focus to it, and press F2.

    The method's name at the top of the right rail, FlowExamples.UnlockGoal, highlighted with an arrow pointing at it.
    The name box open, UnlockGoal shown fully selected for retyping.
  3. Type the new name

    Type the new name, such as OpenGoalWhenEarned.

    The name box mid-edit, reading OpenGoalWhenEarned, not yet committed.
  4. Commit the rename

    Press Enter, or click away.

    The identity header at the top of the right rail and the entry node's title both reading OpenGoalWhenEarned, with the header highlighted and an arrow pointing at it. The purple Previewing your changes. panel counts one rename.
    A second rename in progress, the box reading OpenGoalSoon, about to be canceled with Escape back to OpenGoalWhenEarned.
  5. Rename a variable the same way

    To rename a variable, select its row in the Variables list and click its name in the right rail.

    The Variables list scrolled to the selected _retriesLeft row, highlighted with an arrow pointing at it, and the rename box open on its name at the top of the right rail, also highlighted, with variable · int beneath it.
  6. Compile

    Press Compile in the toolbar.

    The Compile button in the toolbar and the Compile button in the Previewing your changes. panel, both highlighted with arrows pointing at them.
    FlowExamples.OpenGoalWhenEarned after Compile: the highlighted Methods list row, the entry node's title and the highlighted identity header all agree, and the Previewing your changes. panel is gone.

If you also work in C#, this is what is written into the script. This helper uses variables of PlayerController from the Platformer sample, renamed to RefreshCoinDisplay:

Only the name in the script changes. Node positions and zoom are saved separately, and so are wire bends; none of them is affected.

When it goes wrong

SymptomCheckFix
A message appears under the name boxRead it: a character that is not allowed, a reserved word, or a name already taken.Change the name in the box, or press Escape.
F2 shows a lock message instead of a boxRead the message: a lifecycle method, a member from a base class, or a member declared in another file.Keep the name, or rename it in the class or file that declares it.
Full-size image