New class and method
Create a class and its first method from the Round Trip window, build the method on the canvas, then Compile.
On this page
New behavior needs a home before it needs nodes. Make the class first, then give it one small method and build that method on the canvas.
What it does
Section titled “What it does”The Create new class form asks every question a new script needs in one place: its name and folder, its kind, and what it builds on. Pressing Create writes the new class’s script file into that folder straight away. The + on the Methods header then adds a method and opens its empty canvas. The method is not written into the script until you press Compile, so you can build and rearrange it, or undo changes, first.
When to use it
Section titled “When to use it”Make a new class when a new kind of thing enters your game and nothing existing should own its behavior: a coin reporter, a moving platform, a checkpoint, a power-up. Pick MonoBehaviour for something you attach to a GameObject, ScriptableObject for a data asset, or (None) for a plain helper.
Add a method when an existing class needs a new action: a Report on the coin reporter, a Launch on a spring pad, a Respawn on the player.
What it looks like
Section titled “What it looks like”How to use it
Section titled “How to use it”Create CoinReporter and build its Report method
Open the class picker
In the Round Trip graphs window, press the + on the right of the class chip at the top left.
Name the class
Type a name into NAME, such as CoinReporter.
Pick a location
Under LOCATION, pick one of your project’s source folders in the first dropdown, such as Runtime. Pick (here) in the last dropdown to keep the class in that folder.
Pick a parent
Under PARENT CLASS, click the MonoBehaviour card.
Create the class
Press Create (also Create in the New class window).
Add a method
Press + on the Methods header in the left rail. Type a name for the method, such as Report, and press Enter.
Add an input
Press + on Inputs in the right rail. In the new row, pick the type int and type the name count.
Build the method
Right-click empty canvas and place a node from All actions, such as Log. Drag from the entry node’s Exec pin to the new node’s left Exec pin, then from the count pin into the node’s input pin.
10 stepsFull size ↗Compile
Press Compile in the Previewing your changes. panel at the top of the right rail.
If you prefer a form, select the class in Unity and choose Assets > Round Trip > New method. Fill Name and Return type, press Add parameter once per input, and press Create to open the same empty canvas, or Cancel to leave without a draft.
The alternative New method form starts with no name and a void return type. Use Add parameter for each input before pressing Create.
What it writes
Section titled “What it writes”If you also work in C#, this is what is written into the script. With MyGame.Gameplay in the namespace box, the class and method from that exercise, with a log call wired to count, are written as:
The parent you chose brings its using line with it. Any type name Compile writes in full, such as UnityEngine.Debug, is shortened and its namespace imported wherever that cannot make a name in the file ambiguous.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| Create stays blocked | Read the message under NAME, the file path under LOCATION and any message under the namespace box. | Type a name that is allowed and not taken, pick an existing source folder, and type a namespace of C# names joined by dots, or leave it empty for none. |
| The class is written in a namespace you did not expect | Look for an assembly definition over the folder, the namespace the scripts beside it use, and Project Settings > Editor > Root Namespace, in that order. | Type the namespace you want into the namespace box before pressing Create. |
| An input row is rejected | Look at its type dropdown and name box in the Inputs section. | Pick a real type (never void) and a name no other input uses. |










