Call a neighbor
Build a coin pickup on the canvas as a guard followed by a row of calls into the coin, score, HUD, and audio components.
On this page
Many interactions are a handoff. One method checks that the moment is valid, then asks each component that owns a piece of the work to do it, in the order the white wire shows. On the canvas that is a guard at the left and a row of call nodes along one white wire, each node’s Target pin wired from the component it talks to. In the Platformer sample, the player checks the coin, then calls the coin and score counter. The HUD and audio player follow in turn.
This page builds that shape from an empty canvas. It uses the sample’s PlayerController class so every name on the nodes is real. In your own project, build the same shape in any class that calls into other components, once its folder is indexed.
In the sample
Section titled “In the sample”The player notices the coin’s trigger, but the coin owns whether it has been collected, the score counter owns the totals, the HUD owns what is on screen, and the audio player owns the sound. The player’s job is to ask each of them, in the right order.
When this applies
Section titled “When this applies”- Picking something up, opening a chest, or taking damage has to update several parts of the scene at once.
- Each part already has its own component with a method that names its job.
- The order matters: the HUD should show the new score, so the score must change first.
Build PickUpCoin from an empty canvas
Add a method
Open Tools > Round Trip > Graph view, press Cmd/Ctrl+O and choose PlayerController. Press the + on the Methods section of the left rail, type
PickUpCoinin the name box and press Enter. In the right rail’s Inputs card, press +, choose Coin as the type and typecoinas the name. The magenta entry node titled PickUpCoin now has an Exec pin and a purple coin pin.Place the guard
Guard the coin. Right-click blank canvas and pick branch under flow control; wire the entry node’s Exec into it. Place an Equals node from operators, wire the coin pin into Left and type
nullinto Right.
11 stepsFull size ↗Stop on a missing or spent coin
Drag from the coin pin onto empty canvas and press get on IsCollected. Place an Or node, wire the Equals node’s Result and the IsCollected pill into it, and wire its Result into the branch’s Condition. Place a return from flow control and wire the branch’s true output into the magenta EXIT node. A missing or spent coin stops here.
17 stepsFull size ↗Require the score counter and the HUD
Require the score counter and the HUD. In the right rail’s Guards card, press Add a check. The Require a value list opens; pick _scoreCounter. Choose Warn and skip the rest of this method as what happens when one is missing. On the new check, press Add another value to this check and pick _hud.
Call the coin
Call the coin. Drag from the entry node’s coin pin onto empty canvas. A menu headed by the coin lists its variables and methods; click Collect. A teal node titled Collect appears with Coin above its title and its Target already wired from the coin pin. Wire the branch’s false output into its Exec.
6 stepsFull size ↗Call the score counter
Call the score counter. Right-click, type
_scoreCounter, press get, then drag from the purple pill and click AddCoins. Wire the Collect node’s Exec output into it. Get a CoinsPerPickup pill and drag it onto the green count pin.
12 stepsFull size ↗Call the HUD with the new totals
Call the HUD with the new totals. Get a _hud pill, drag from it and click RefreshCoins. Wire AddCoins’ Exec output into it. Get a second _scoreCounter pill, drag from it twice, pressing get on Coins and then on Score, and wire the two green pills into coins and score.
20 stepsFull size ↗Call the audio player
Call the audio player. Get an _audio pill, drag from it and click PlayCoin. Wire RefreshCoins’ Exec output into it.
8 stepsFull size ↗Compile
Press Compile in the toolbar.
What it writes
Section titled “What it writes”If you also work in C#, this is the sample’s CollectCoin, the finished shape the steps build toward: a guard branch, then Collect (target from the coin pin), AddCoins (target from the _scoreCounter pill, count from CoinsPerPickup), RefreshCoins (fed by the Coins and Score pills) and PlayCoin (target from _audio). Your PickUpCoin writes the same guard and the same four calls in order; the check from the Guards card is written as its own early exit with a warning.
In the sample, the audio call runs only when an audio player is present, so a scene without one still collects coins.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| The HUD shows the previous coin total. | Follow the white wire: does RefreshCoins come before AddCoins? | Rewire so AddCoins runs first and RefreshCoins follows it. |
| A scene without an audio player stops collecting coins. | Open the Guards card and read which values the check requires. | Keep _audio out of the check; require only _scoreCounter and _hud. |
| The same coin scores twice. | Follow the guard branch: does an IsCollected pill feed its condition, and does Collect run first on false? | Feed IsCollected into the Or node, and keep Collect as the first node after the guard. |
- Method calls: choose the object to call and fill its argument pins.
- Get and set: read updated properties for the next call.
- Branch: protect required component references with early exits.





