Arrays, tuples, and ranges
Build arrays and grouped values, read or change their elements, and work with slices and tuples on the canvas.
On this page
A list of checkpoints, the last spawn point, the middle stretch of a path, a coin count and a score handed back together: these use arrays with element access, and also ranges and tuples. An array holds a fixed number of elements of one type; a tuple groups values that can have different types, such as a count and a position. Each operation has its own node in the construction and collections group of the action menu.
What it does
Section titled “What it does”Make array builds a list from the values wired into its element pins. Element access picks one element out of a list by position, and Set element replaces one. From end counts a position from the back, so the last element is position 1 from the end. Range names a stretch of positions and Slice cuts that stretch out of a list. Make tuple bundles a few values into one wire, and Break tuple splits a bundle back into separate named values. Make struct builds a small value such as a position or a color from its parts.
Each element and each position is its own pin, as is every bundled value, so you can see what goes in without opening anything.
When to use it
Section titled “When to use it”Use Make array when the game needs a fixed list: patrol points, the scores that earn each medal, the sounds a footstep can play. Use Element access to pick one of them, such as the next patrol point, and From end when you want the last one, such as the final checkpoint. Use Range and Slice to take part of a list, such as every checkpoint except the first and last. Use Make tuple when one step of your visual script should hand back two or three values together, such as coins and score, without creating a new type; use Break tuple to give each of those values its own name again. Use Make struct for a value made of named parts, such as a spawn position.
To make a variable hold an array, click its type in the Variables or Local variables list. Array sits at the top of the type chooser, after var for a local. Pick it and the chooser opens again to ask what type of element it holds, so the row becomes, for example, int[] or Vector2[]. An array of arrays is not offered this way.
What it looks like
Section titled “What it looks like”The complete ReadCheckpoints canvas is paired with its source in What it writes. Trace the array output to the element pick and the slice, then follow the purple tuple wire into BREAK TUPLE. Each node has a pin for every element, index, range end, or bundled value; the one screenshot keeps these relationships together.
How to use it
Section titled “How to use it”Build arrays, tuples, and ranges
Place Make array
Right-click empty canvas and search for Make array. Pick the construction action with the [] mark.
Fill the first element
Click beside the first element pin and type
2f.Add another element
Fill the second element with
5f. Press add pin ⊕ and fill the third with9f.Read an element
Place Element access from the canvas menu. Wire the array’s output into Collection and enter
0in Index.
9 stepsFull size ↗Count from the end
Place From end and enter
1in Operand. Wire its Index output into the reader’s Index input.
9 stepsFull size ↗Read a slice
Place Range and set Start to
1, leaving End empty. Place Slice. Connect the array to Collection and the range to Range, then replace the element reader’s collection wire with the slice’s Result.
20 stepsFull size ↗Write an element
Place Set element and connect its Exec input to the method entry. Wire the array into Collection, set Index to
0and Value to3f.
16 stepsFull size ↗Bundle three values
Place Make tuple and fill its two inputs with
3and30. Press add pin ⊕ and enter5in the third.Unbundle the values
Place Break tuple and wire the bundle into it. Connect the white Exec pins of its companion declaration node after Set element.
11 stepsFull size ↗Choose a struct constructor
Choose Make struct, search for
Vector3, and pick the constructor with x, y and z.
6 stepsFull size ↗Compile and inspect the result
Press Compile.
What it writes
Section titled “What it writes”The scratch walkthrough writes these two statements. Its unconsumed slice/read chain and Vector3 draft are not part of this method’s C#:
The separate ReadCheckpoints example below instead stores its array and consumes the reads in local declarations:
When the script already spells an array or a tuple its own way and the node’s shape has not changed, Compile keeps that spelling.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| The Make array node stays wildcard gray | Look at its element pins: none has a wire or a typed value yet. | Fill the first element so the list type can settle. |
| Compile leaves a pick or store unfinished | Look for a required collection, index or value input without a source. Range endpoints may deliberately be empty. | Fill the required input, or delete the unfinished node. |
| A Break tuple inside another Break tuple will not Compile | Look for a bundle wired straight into a second unbundle on the same partner node. | Finish that shape in C#: the canvas flattens it. |




