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 enter a complete API identifier.

Browse the reference instead

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

v0.89.0
Menu

Your first method

Create a Unity class, add a method on the graph, and Compile one call into ordinary C#.

A blank project is enough. You will make a component, give it one method, and put a message in the Console without typing the method body.

A designer needs a small gameplay hook, perhaps a message when a coin appears, but the project has no suitable component yet. The class and method both need to become normal C#, along with a call that another teammate can open.

  • You are starting a new behavior and the project lacks a class to hold it.
  • You know what should happen, but you would rather choose calls and values on a canvas.
  • You want the first result to be a small source diff that a programmer can read.
A method from nothing: name it in the new method window, see it as a draft, press Compile, and it is C# in PlayerController.cs.
A method from nothing: name it in the new method window, see it as a draft, press Compile, and it is C# in PlayerController.cs.
The new class window with its name, location, class kind, access, and parent choices.
Figure 1. The new class window keeps the file location and type choices together.
The new method window with name, return type, and parameter controls.
Figure 2. The new method window builds a signature before the graph preview opens.
  1. In Unity’s Project window, create a folder at Assets/Game/Runtime. Select that folder. A source folder gives the new file a clear home.

  2. Choose Assets > Round Trip > New Class. The utility window title is new class.

  3. Enter CoinAnnouncer under NAME. Under LOCATION, choose the Runtime source folder, leave kind as class, and leave access as public. Choose MonoBehaviour in PARENT CLASS so the class can be attached to a GameObject.

  4. Read the resolved path beneath the location row. The selected source folder determines the namespace used by this window. The current window does not ask for a separate namespace value, so check the resolved result before choosing create.

The new class window ready to create CoinAnnouncer.
Figure 3. Folder, kind, access, and parent all contribute to the class that will be written.
  1. Select CoinAnnouncer.cs in the Project window and choose Assets > Round Trip > New Method. The window title is new method.

  2. Set name to AnnounceCoin. Leave return type as void, and leave parameters empty. The current window creates an ordinary public method. Access is fixed to public here; this window has no access picker.

  3. Choose create. Round Trip buffers the new method and opens its preview graph. Nothing has been added to the .cs file yet. With the class open in Graph View, the + on the Methods rail section does the same without the window: the new row opens as a name box holding NewMethod (then NewMethod1, NewMethod2), Enter names it, and Escape keeps the default.

  4. Right-click blank canvas space. In the action menu, leave context sensitive on, find Debug.Log, and use the call action. method group would name the method as a value; call invokes it.

  5. Connect the white exec wire from the entry node to the call if the new node is not already placed in sequence. Click the unwired message data pin and enter the string literal Hello from Round Trip.

  6. Read the panel pinned to the top of the right rail: Previewing your changes. The call and its literal are still a draft, and the toolbar Compile has turned amber. The source file has not changed.

  7. Press Compile in the toolbar. Round Trip writes the method, asks Unity to import it, then re-parses the source into the graph.

  8. Open CoinAnnouncer.cs. Find AnnounceCoin and read the one call with its string literal.

The Previewing your changes panel and the toolbar Compile above a pending graph change.
Figure 4. The panel separates a graph draft from a source change.

When it goes wrong

SymptomCheckFix
New Class is disabled.Confirm a folder, not a file, is selected in the Project window.Select Assets/Game/Runtime and open Assets > Round Trip > New Class again.
New Method is disabled.Confirm CoinAnnouncer.cs is selected and Round Trip has indexed its type.Wait for Unity compilation to finish, then select the C# file again.
Debug.Log is missing from the call list.Confirm the class inherits MonoBehaviour and the file can see UnityEngine.Use the parent choice from step 3, then reopen the canvas action menu.
Compile is disabled.Look for a valid literal and a complete exec path through the call.Correct the pin value or wire, then hover the toolbar Compile to read why it is held.
Full-size image