What gets written
See which canvas changes touch one spot in the script, which rewrite a whole method, and which never reach the script.
On this page
Typing a new number into one pin should not reshuffle a whole script. When you press Compile, Round Trip changes the smallest part of the script it safely can.
What it does
Section titled “What it does”A canvas holds three kinds of change. Some change one small thing the game does, such as a typed value. Some change the shape of a method, such as a new BRANCH node or loop. Some only change how the canvas looks, such as where a node sits. Compile treats each kind differently, so a teammate who reads the script afterwards sees only what you meant to change.
When to use it
Section titled “When to use it”Keep this in mind when you review a change before pressing Compile, or when a teammate asks why a script changed. A typed value or a variable’s starting value changes one spot. Adding or removing a BRANCH, a loop, a switch, or a try catch node rewrites that one method from top to bottom. Dragging a node to a new place changes nothing in the script at all.
What it looks like
Section titled “What it looks like”
The loop shows a method built on the canvas being saved into the script and reloading on the canvas.
For a smaller comparison, these two captures show PlayerController.AwardPickup with the same call and target, but a different literal. They illustrate the visible value change. Neither frame is a version-control diff or a Compile status panel.
How to use it
Section titled “How to use it”Retype a value, add a BRANCH, and compile
Retype a number
On a method canvas, click the value beside a number pin and type a new number.
Add a BRANCH and wire it
Right-click empty canvas and pick branch under flow control. Drag the white wire through the yellow BRANCH node, from the node before it into its Exec pin and from its true pin onward, and wire a red yes-or-no value, such as a comparison’s Result, into Condition.
16 stepsFull size ↗Move a node
Drag any node to a new place.
3 stepsFull size ↗Compile
Press Compile in the toolbar.
Focused source edits
Section titled “Focused source edits”When the script still matches what the canvas loaded, a small change replaces only the text it owns. This covers renaming a method, editing a comment, changing an attribute or a variable’s starting value, editing a property, adding a guard, and changing one typed value, object reference, operator, wire, or node that maps to one line. The spacing and blank lines around that spot stay as they were.
Variables follow the same rule. Changing one starting value replaces that one variable’s declaration. Adding a variable puts its declaration after the class’s last one, in the file’s own spacing and line endings.
When a Compile adds a new method, the SET nodes, return nodes, and throw nodes you built in it are written into that method once the method is in the file. A GET pill is never a line of its own: it is written inside whatever node it feeds.
Type names and usings
Section titled “Type names and usings”When you pick a type for a variable or an input that the script does not already know about, Round Trip first writes its full name, because that always works. Once the save is done, it shortens each full name on the lines it wrote and adds the matching line at the top of the file that lets the short name work.
It shortens a name only when that cannot change what the name means. A name stays in full when another type with the same short name is already visible to the file, or when the new line at the top would bring in a second type with a name the file already uses. Lines you or a teammate wrote are left exactly as they are.
A static method you place from search or browse follows its own rule: its type is written using the name that already resolves to that type in the file. Where the file reaches the type by its short name, the call reads Debug.Log(message); where it does not, the type is written in full, such as Platformer.Runtime.Logic.CoinUnlockRule, and no line is added at the top.
Rewriting a whole method body
Section titled “Rewriting a whole method body”Some changes alter the shape of a method: the arms of a BRANCH, the inside of a loop, the cases of a switch, the handlers of a try catch, and some changes to the order of nodes. These are written as one whole method. Before writing, Round Trip checks that every node in the method is complete and that the method it is about to write matches the one it loaded wherever you made no change. A statement you deleted from that method leaves in the same write; if Round Trip can no longer find it, it refuses rather than remove a different line.
After a whole method is rewritten, the positions of later parts of the file can move. Round Trip reloads and re-checks them before making the next change in the same save. If it cannot line them up, it stops instead of guessing.
Diagram settings only
Section titled “Diagram settings only”Nothing about layout enters the .cs file: node positions, where the view is scrolled to, zoom, wire bends, and folded sections. They are saved in the diagram’s own settings file, linked to that script. That file describes how the canvas looks, never what the game does.
What it writes
Section titled “What it writes”If you also work in C#, this is what lands in the script. A typed value change can be as small as one token. This line is a ScoreCoins draft on ScoreCounter in the Platformer sample, with 12 typed into the multiplier:
A change of shape replaces the method’s whole body and leaves its name line and the members around it alone. This body is an AddPositiveCoins draft based on AddCoins on the same ScoreCounter:
A type picked for the input of a new Configure overload on PlayerController is first written in full and then shortened. LevelRules lives in the same namespace as PlayerController, so the short name needs no new using line; a type from another namespace would also get its using line added at the top of the file:
Unity imports the saved file, and Round Trip reloads the class and canvas from it. File-writing safeguards do not replace a backup: Edits from outside explains their limits.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| More of the method changed than expected | Look on the canvas for a BRANCH, loop, switch, or try catch node you added, removed, or rewired. | That reshapes the method, so the whole method is written. Review the canvas before pressing Compile. |
| The next change refuses right after a big one | Read the message: it mentions parts of the file it could not line up. | Let the canvas finish reloading, open the method again, then make the next change. |





