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

Edits from outside

Understand how Round Trip notices file changes and protects a draft from concurrent source edits.

C# can change in an editor, through version control, during a merge, or from a code generator. Round Trip must stop showing the old meaning when that happens.

A graph draft is based on a particular file timestamp and set of source spans. If another tool changes that file, writing the old draft could overwrite new work or splice text into the wrong range.

Use this flow whenever a code editor, merge, branch switch, generator, or teammate changes a .cs file while the Round Trip window is open.

Code and graph in one loop: the parsed method, the same method after a line was typed into the file, a method drafted in the graph, and that draft compiled into the file.
Code and graph in one loop: the parsed method, the same method after a line was typed into the file, a method drafted in the graph, and that draft compiled into the file.

The loop begins in C#, opens the parsed graph, writes a draft, and returns to source.

Files under Assets arrive through Unity’s import path. Registered external source roots use recursive file watchers for changed, created, deleted, and renamed .cs files. Events are deduplicated and collected for 150 milliseconds before indexing work begins.

If Unity is compiling, importing, or otherwise busy, Round Trip waits and retries after 1000 milliseconds. Returning focus to the Unity editor also prompts a source check, which covers watcher events that an operating system or file provider did not deliver.

  1. Before switching to a code editor, decide whether to keep or discard any pending Round Trip draft.
  2. Save the C# edit in the external editor.
  3. Return to Unity. Let Unity import the file and Round Trip re-index it.
  4. Reopen the class or method. The graph is rebuilt from the latest source, including supported changes and marked unsupported placeholders.
  5. If you kept a graph draft open while source changed, do not force it through. Read the stale-source message and discard the draft.
  6. Reapply the intended graph edit against the new source-backed graph, then Compile.

Round Trip does not rewrite an external edit merely because it noticed the file. It re-indexes this source and rebuilds the graph from it:

Immediately before a source mutation, Round Trip compares the file timestamp with the baseline captured for the draft. A mismatch reports:

{file} changed while compiling; discard and try Compile again.

The write is cancelled. The newest external file remains intact, and the draft is not silently rebased onto it. This conservative stop is important because matching method names do not prove that statement spans and declaration trivia still match.

Successful writes use the atomic overwrite path, ask Unity to import and refresh the changed file, and then re-index project types. The graph displayed afterward comes from the new source.

When it goes wrong

SymptomCheckFix
The graph still shows the prior methodCheck whether Unity is compiling or importing.Wait for the busy state to clear, then return focus to Unity or reopen the method.
Compile reports that the file changedCompare the current source with the draft baseline.Discard the draft and reapply it to the current graph.
A renamed file disappears brieflyAllow the paired delete and create or rename events to settle.Wait for the 150 ms batch and the following re-index before reopening it.
Full-size image