Platformer
Install the Platformer sample package from Package Manager, import its sample, play it, then explore coins, stomps, score, and enemy state through visual scripts drawn from its C# methods.
On this page
A coin disappears, the score climbs, the door opens, and a stomp turns a walking enemy into a defeated one. The Platformer sample gives you a complete minute of play, then lets you open each decision as a Round Trip visual script and compare it with the canvas you build yourself.
What the sample is
Section titled “What the sample is”The Platformer sample is a small 2D game written in ordinary C#, made for learning Round Trip on real classes. It is an optional package of the same Round Trip product, Round Trip Sample - Platformer, so you get it from Package Manager > My Assets rather than as a separate download, and installing it also installs Round Trip itself and the Input System. Importing its sample adds its scene, scripts, input actions and art to your project under one folder. Import it into a practice project, not your real game, because those assets could interfere with your own.
Its classes are the examples used across this site: PlayerController, PlayerMotor, ScoreCounter, EnemyStateMachine, EnemyPatrol, Door and others. When a guide or tutorial names one of them, it is showing the finished sample as a picture to compare against. The guides teach you to build the same shapes on your own classes, once their folder is indexed. The Round Trip package lists a second sample, Graph Viewer Sample; this page uses Platformer.
Before you import
Section titled “Before you import”- Round Trip is installed in the project (Install).
- The project uses Unity 6 or Unity 2022.3 and the Universal Render Pipeline (URP). The Universal 2D template has it, so it is the easiest practice project. The sample does not support the Built-in Render Pipeline or the old Input Manager.
- The Round Trip Sample - Platformer package is installed from My Assets. It installs the Input System with it, and Unity may then ask to enable the Input System’s input backend and restart the editor. Round Trip itself never asks for that; only this optional package does.
Where the files land
Section titled “Where the files land”Package Manager copies the sample into Assets/Samples/Round Trip Sample - Platformer/<version>/Platformer/, for example Assets/Samples/Round Trip Sample - Platformer/1.0.0/Platformer/. Leave it there: Package Manager tracks what you imported by that path. Every sample path on this site starts at that Platformer folder, so Platformer/Runtime/Player/PlayerController.cs is Assets/Samples/Round Trip Sample - Platformer/<version>/Platformer/Runtime/Player/PlayerController.cs in your project. A few captures on other pages were taken in the project the sample is authored in, where the same folder sits at Assets/Platformer; the contents are the same.
Round Trip finds the classes by itself. When the import finishes it adds the copy’s Runtime folder to the folders it indexes and writes one information line to the Console naming the folder it added; there are no warnings or errors. No dialog opens, and you do not need the Setup wizard or Add folder to Round Trip for this sample.
When you update the Platformer sample package and import the sample again, Package Manager creates a new versioned folder next to the old one. Round Trip adds the new copy’s Runtime folder. Delete the old version’s folder, because two copies of the same assembly cannot compile together.

Play it in one minute
1 minute
- Scene
Platformer/Scenes/Platformer.unity- Select
- Player in the Hierarchy
- Controls
- Arrows or A/D move, Space jumps
- Goal
- Collect coins, stomp enemies, reach the goal
What this game teaches
Section titled “What this game teaches”- Guard clauses: a yellow BRANCH with a magenta EXIT node on one side stops a duplicate collection, a missing component reference, or a repeat stomp before anything changes.
- Calls: teal call nodes show which other objects the player talks to: the coin, the score counter, the HUD, the motor and the audio service.
- Loops: a yellow FOR node checks each collision contact to decide whether the player is standing on the ground.
- Branches: yellow BRANCH nodes choose the score and HUD paths only when their references are present.
- Switch: one yellow SWITCH node gives each enemy state its own row of nodes that turn patrol and the body collider on or off; the defeated row also applies the defeated look.
- GET and SET: pills and SET nodes show where tuning values and current state enter each decision.
Import it and read its first method
Section titled “Import it and read its first method”Import the sample and read its first method
Open Package Manager
Choose Window > Package Management > Package Manager. In Unity 2022.3 the item is Window > Package Manager.
Select Round Trip Sample - Platformer
In My Assets, install Round Trip Sample - Platformer, then select it under Packages - Bit Quirky, LLC.
Open the Samples tab
Open the Samples tab of Round Trip Sample - Platformer.
Import Platformer
Press Import next to Platformer and wait for Unity to finish reloading.
Open the scene
Open
Platformer/Scenes/Platformer.unityby double-clicking it in the Project window.Press Play
Press Play and move with the arrow keys or A and D; jump with Space.
Open Graph view
Open Tools > Round Trip > Graph view. The Round Trip window opens.
4 stepsFull size ↗Pick PlayerController and CollectCoin
Click the class chip at the left of the top rail, or press Cmd/Ctrl+O. Choose the Runtime scope, pick PlayerController, then click CollectCoin in the Methods list of the left rail.
4 stepsFull size ↗
From diagram to gameplay
Section titled “From diagram to gameplay”| Method to open | What the canvas shows | What to notice when you play |
|---|---|---|
| CollectCoin on PlayerController | An early stop, then four call nodes in a row. | The coin arrives from the trigger you touch. Score and HUD are set up in the scene; audio is optional. |
| StompEnemy on PlayerController | A guarded state change and a bounce, then score and HUD branches inside one another. | The score you gain comes from stompScoreValue on the LevelRules asset. |
| UpdateGrounded on PlayerMotor | A FOR node checks each contact and reaches EXIT at the first one facing up. | Walls do not count as ground; only contacts facing up past the grounding threshold do. |
| OnCoinCountChanged on ScoreCounter | A missing-reference stop, a threshold check, and a call node on the door. | The door opens when the coin count reaches the threshold from LevelRules. |
| ApplyState on EnemyStateMachine | One SWITCH node with one output per enemy state. | Each state turns patrol and collision on or off; the defeated state also changes the look. |
Follow one method: CollectCoin
Section titled “Follow one method: CollectCoin”CollectCoin starts at its magenta entry node, whose purple coin pin carries the coin you touched. The yellow BRANCH sends a coin that is missing or already collected to an EXIT node, and the method also stops when the scene’s score counter or HUD is missing. Only then does the white wire reach the teal Collect call on the coin, the AddCoins call on the score counter, the RefreshCoins call on the HUD, and the PlayCoin call on the optional audio service.
That order is the lesson. Each teal node names one neighbor, and the colored wires show which values cross from one object to the next. The canvas is the method itself, so what you see is what runs.
Exercises
Section titled “Exercises”The same game, rebuilt without writing code
Section titled “The same game, rebuilt without writing code”The same platformer is also being rebuilt on camera, one episode at a time, with every method built on the Round Trip canvas and none of it typed. That tutorial build contains only what the published episodes have built so far, starting with LevelRules, PlayerMotor and the scene setup code that connects the components, plus script-free prefabs for the tiles, player, coin, enemy and goal door to build from. Open the finished Platformer sample when you want a complete picture to compare against; follow the episodes when you want to watch the build.















