Skip to content

Tilemaps

Entity → Level → Tilemap, then set its Image to a tileset and its Columns and Rows to the tileset’s layout. While a tilemap is selected, the Scene view paints:

  • Pick a tool under the palette, or with a key: the Brush (B) paints the cells you drag over, the Rectangle (R) fills the box you drag out (shown as you drag; Esc lets go of it), Fill (G) fills the area you click, like a paint bucket: the cell and every cell joined to it side by side holding the same tile, or all empty, within the map’s grid (hovering with Fill shows the area it would fill), and the Line (L) drags out a line round a corner, each cell turned the way it runs (see Lines with corners).
  • Hold Shift with any of them to erase instead. Each stroke, rectangle or fill is one undo step.
  • Pick a tile from the palette at the top left, with [ and ], or Ctrl-click a painted tile. The mouse wheel scrolls a palette with more tiles than fit.
  • Turn the tile you paint with Z (a quarter clockwise; Shift+Z back), and flip it with X (left to right; Shift+X upside down): see Turned and flipped tiles.
  • The tabs along the palette’s top switch between the map’s tilesets. Its + tab (or Art → Add Tileset to Tilemap) adds another from the project’s images: a picture painted in Griff keeps its own tiles across and down, and any other is cut into tiles the size of the first tileset’s.
  • The buttons under the tools switch between the map’s layers, and + Layer adds one (see Layers). The layers not being painted fade back.
  • Paint (or drag a rectangle) past the left or top edge and the map grows that way; its layers (and anything else inside it) stay where they are.
  • The Select tool (V), first under the palette, is the cursor: with it picked, clicks and drags select and move things as they do with no tilemap selected (the map itself too, with its handles), and the palette stays up to pick a painting tool again. The tool stays as you leave it while you select other things, so a tilemap selected again with Select picked doesn’t paint until you pick the Brush, Rectangle, Fill or Line (the editor starts on the Brush).
  • Press Esc (or select something else in the Hierarchy) to stop painting.

A map’s Image is its first tileset, with tiles numbered from 0. More Tilesets adds others, one per line with their tiles across and down (Tiles/props.png 4x4), and each one’s tiles are numbered on from the next hundred after the tiles before it: with a first tileset of 16 tiles, the second’s are 100 on and a third’s 200 on. A tileset that grows (up to the next hundred) doesn’t renumber the ones after it, and every field that lists tile numbers (Background Tiles, Auto Tiles and the rest) uses these numbers, so 100-103 are the second tileset’s first four tiles.

Before there’s any art, leave a tilemap’s Image empty and give it Placeholder Colors, a color a row: tile 0 draws as a solid square (a diamond or hexagon, on those maps) of the first color, tile 1 of the second, and so on, so a floor can be a checker of two grays and wall tops and wall faces two shades of their own. The palette shows a tile of each color to paint with, and the tile fields (Background Tiles and the rest) show them too. A tile number past the end of the list goes round it again, and Tint still multiplies them. Tick Placeholder Grid for a thin line round each tile, a little darker than it (lighter on a dark tile), so the cells show on a floor of one color. A map’s layers use its colors and grid, so tile 2 is the same color on every layer; giving the map an Image puts the colors away (they come back if it’s cleared). Scripts read a tile’s color with PlaceholderColorOf(tile), and agents set the list as an array of hex colors, e.g. "PlaceholderColors": ["#3A3F4B", "#343844", "#FF00FF", "#99009A"].

A map can have several layers, painted one at a time: a background of walls behind, the level’s solid ground, and decoration in front. + Layer under the palette (or Art → Add Layer to Tilemap) adds one on top of the others and switches painting to it; the buttons beside it switch back. A layer is an entity inside the map’s, holding a tilemap with no Image of its own, so it shows in the Hierarchy where it can be renamed, reordered, hidden while you paint the others (its eye), turned off or deleted like anything else; switching to a hidden layer shows it again. It paints with the map’s tilesets, tile size and tile settings (Background Tiles, Auto Tiles and the rest), and the Inspector leaves those out on it, but its tiles, Tint, Order and collision are its own: a new layer draws over the others and doesn’t collide until you turn on its Solid, and its Layer and Ignore Layers set which bodies it stops, so a wall layer can block everyone while a ghost walks through. Giving a layer an Image makes it a map of its own again. Agents add a layer with Art.AddTilemapLayer (or entity_create with a Tilemap and the map as its parent) and switch with the Scene view’s ShowLayer.

The map’s tiles are also plain text in the Inspector, one row per line and one character per cell (. is empty, 0–9, a–z, A–Z are tiles 0–61, and tiles from 62 on are accented letters from À, then CJK characters from 一, which scenes save as they are), so you can type a level out or paste one in. With Solid on, tiles are walls and floors, except:

  • Background Tiles never collide: grass, windows, signs. List tile numbers and ranges, e.g. 10-15, 20.
  • One Way Tiles are platforms you jump up through and land on.
  • Ladder Tiles never collide, and players climb them.
  • Slope Up Tiles (/) and Slope Down Tiles (\) are 45 degree slopes, solid below the line from corner to corner. Players and enemies walk up and down them without leaving the ground, land on them and jump from them; the tall side is a wall, and the flat bottom is a ceiling. Raycasts see them too, so patrolling enemies walk them.

A tilemap’s Lines Up With names another tilemap (Level) whose cells its own line up with: it takes that map’s Tile Size and Shape, and its top left stays on a corner of that map’s cells, moved to the nearest as it’s set, as it’s dragged in the Scene view and while the game runs (one spawned off the grid snaps onto it). Its tiles and tilesets stay its own. It’s how a match-3 or falling-blocks board sits on a platformer level’s squares, and with Solid ticked its pieces are part of the level (see One grid).

Set Auto Tiles to a run of 16 tiles in the tileset (16-31, or just 16) and paint with any of them: each cell shows the piece that joins up with its neighbors from the same run, in the Scene view and the game, so grass edges and cave walls take care of themselves. The run’s tiles go in order of which sides join, counting up as 1, right 2, down 4 and left 8: the first is a lone block, the second joins only above, and the last joins on every side.

The Scene view outlines what collides: one-way runs get a dashed outline with a solid top edge, and slopes a triangle.

Set a tilemap’s Shape to Isometric and its cells become diamonds twice as wide as they’re tall, the grid’s columns running down to the right from the map’s position (the top corner of its first cell) and its rows down to the left. Tile Size is a diamond’s width. Painting follows the diamonds: the brush, rectangle and fill paint the cell under the pointer, the hover outline and the grid’s edge are diamonds, and painting past the top edges grows the map up its diagonals. The tiles are drawn back to front, a diagonal at a time, so taller ones overlap those behind them. Tile Height says how tall each tile’s picture is, in tile widths: 0.5 is a flat diamond (a floor), and 1 a square picture, a block or wall standing up from its diamond as tall again; a picture stands on its cell’s bottom corner. A tile with no tileset is drawn as its diamond. A map’s layers share its shape and tile height.

Floors and walls go on separate layers. A map draws as one, behind what’s on it (its place is its top corner, above everything standing on it), which is right for floors. Turn on Sort By Y on a wall layer (and on the camera) and each of its rows is drawn in its own place among the sprites, so a character walks behind a wall and in front of it (sprites sort by the bottom of their pictures, their feet). Sort By Y works on square maps too, a row at a time, for trees and pillars a top-down hero passes behind. The rows sort among a Sort Group (a stack of crates on a pallet) as among any sprite, by the group’s feet. Scripts find cells with CellAt and CellCenter as on any map, PointAt(x, y) for a point along the grid (and GridAt(point) the other way, in columns and rows), OutlineOf for a box of cells’ corners and PictureOf for where a tile is drawn.

A solid isometric map’s tiles are walls shaped like their diamonds (turn Solid off on the floor, or make floor tiles Background Tiles, and keep it on for a layer of walls). A body meets them with the diamond under its collider: as wide as the collider, half as tall, round its middle, so give a character a flat box at its feet. It slides along a wall the way the wall runs on the screen, crates shoved into one stop there, and raycasts (an enemy’s sight) and OverlapPoint, OverlapBox and OverlapCircle see the diamonds. The Scene view outlines the solid diamonds, and each body’s footprint inside its collider. Tick Isometric on a Top-down Movement (the Inspector reminds you on an isometric map) and up and down go half as fast on the screen as left and right, as the ground is seen at a slant, so up and right together run along the diamonds’ edges; with Four Way too, its four ways are the diamonds’ edges (up goes up to the right, right down to the right, down down to the left, left up to the left). A Grid Movement steps from diamond to diamond the same way, and two ways held together step to the diamond that way on the screen; with Diagonal, every way pressed goes that way on the screen (up steps to the diamond straight above). Grid movers face the way they step, flipping their sprites and playing Up clips going up the screen and Down clips coming down it; chasers, patrols, pushed crates and pathfinding work on the diamonds as on squares.

Set a tilemap’s Shape to Hex and its cells become hexagons pointing up and down, for board games, strategy and tactics. Each is a tile wide and a tile tall (Tile Size), so a tileset of square tiles with a hexagon in each fits: its points at the middle of the top and bottom edges, its sides straight down the left and right edges from a quarter of the way down to three quarters. Rows are three quarters of a tile apart, so each row’s points fit between the row above’s, and every odd row (the second, the fourth…) is shifted half a tile to the right; the map’s position is the top left of its first cell’s picture. Painting follows the hexagons: the brush, rectangle and fill paint the hexagon under the pointer, the hover outline, a dragged rectangle and the grid’s edge follow the hexagons’ sides, and a fill spreads to the six hexagons round each cell. Painting above the top row grows the map up two rows at a time, so the odd rows stay the shifted ones. Tiles are drawn a row at a time, each row over the points of the one above, and Sort By Y sorts the rows among the sprites as on a square map; a tile with no tileset is drawn as its hexagon. Neighbors(x, y) lists the six cells round a hexagon (the four round a square), and CellAt, CellCenter and OutlineOf work on hexagons. A map’s layers share its shape.

On a hex map a Grid Movement steps from hexagon to hexagon, six ways: left and right along the row, up or down with left or right held to the hexagon up or down on that side, and up or down alone to the hexagon above or below that keeps it heading straight up or down the screen (it zigzags between the two, a row at a time, without turning its sprite). Solid tiles block it as on a square map, and Diagonal changes nothing, since every one of the six ways is along a side. Step(x, y) takes the same ways (Step(1, 1) is the hexagon up to the right), and a Grid Patrol’s points count columns and rows, so 0 2 is straight up the screen. Chasers and patrols find their way round walls over the six neighbors and stop next to their target in any of them, crates are pushed straight on whichever of the six ways they’re pushed, bump attacks hit what’s in the hexagon stepped into, and turn takers take turns a hexagon at a time. Tactics units walk and fight over the hexagons too: their reach and range are counted in hexagons (an archer with a Range of 3 and a Min Range of 2 hits the ring of hexagons two and three away), and the cells they can walk to and hit, and the cursor, are lit as hexagons (as diamonds on an isometric map).

A solid hex map’s tiles are walls shaped like their hexagons (turn Solid off on the floor and keep it on for a layer of walls, as on any map). A body meets them with its collider as it is, box or circle: walking into a hexagon’s straight side stops it there, and walking into a slanted side (or a point) slides it along that side, so a player running up into a wall of hexagons slips off the points into the notches between them, and one running along a jagged wall follows its zigzag. Crates shoved into a wall stop there and stop what shoves them, and something falling onto hexagons lands on them (Is Grounded, with the map as its Ground). Raycasts (an enemy’s sight, a turret’s) and OverlapPoint, OverlapBox and OverlapCircle see the hexagons, so an enemy that needs sight can’t see you through a hex wall, and lights with Shadows cast them from the hexagons’ sides that face open floor. The Scene view outlines the solid hexagons, a row at a time. A body standing still isn’t pushed, so a grid mover keeps to the middle of its hexagon whatever its collider’s size.

A Wall Rooms on a map finds the rooms its walls make, for heat, air, noise or how many people fit: every patch of floor cells joined side by side (four ways, six on a hex map) without crossing a wall. Walls are the map’s solid tiles on it and its layers, as grid movers see them (untick Solid Tiles to leave them out), its Wall Tiles even where they’re walked through, so listing a door’s tiles (300-301) keeps a door shut between rooms, and solid colliders on its Wall Layers (Walls, Doors) over a cell’s middle, for walls built as entities; grid movers never count. A room that reaches past the map’s edge is open to the outside, and with Empty Is Outside so is one next to a cell with no tile on any layer (a floor painted in a building’s shape, a hull with a hole in it). Tick Show to tint each closed room a color of its own, in the Scene view as you paint and in the game.

The rooms are worked out again only when the walls change (a tile painted or cleared, a wall collider added, moved or removed), not every frame, and at the end of that step it raises Changed and sends its Message (with the map’s entity). Each room has an Id it keeps as walls go up and come down: split in two, the bigger part keeps it and the smaller gets a new one; joined, the room takes the id of the one it has most of. Its Area is its count of cells. A Text or Counter shows the Output Closed (how many rooms walls close off), RoomArea:Furnace (the area of the room the entity called Furnace stands in) or RoomId:Furnace. Scripts read Rooms (each a WallRoom with Id, Cells, Area, Open and Closed), ask Room(id), RoomAt(cell) or RoomAt(point), RoomOf(entity) (the cell its position is in), EntitiesIn(room) and EntitiesIn<T>(room) (a room’s machines or workers), convert with CellAt and CellCenter, hear Changed, and call Refresh() to see walls they changed this step straight away. What the rooms were is kept by a rewind (each room’s id comes back with it, with no Changed) and is the same on every machine in a network game.

Set a tilemap’s Animated Tiles to runs of tiles side by side in its tileset and how many frames a second, 16-19 @6, and every cell painted with one of them plays through the run while the game runs: water, lava, torches. Paint neighbors with different frames of the run and they won’t move in step.

A cell can hold its tile turned by a quarter, a half or three quarters, or flipped, so a conveyor belt, an arrow, a pipe or a cliff edge is drawn once, pointing one way, and painted pointing any way (an animated belt’s frames turn with it).

  • While painting, Z turns the brush a quarter clockwise (Shift+Z turns it back), X flips it left to right and Shift+X upside down. The palette shows the brush’s tile turned, the cell under the cursor shows it faintly where it will go, and the hint under the palette says how it’s turned (“Brush (turned 90°)”). Ctrl-clicking a painted cell picks up its turn with its tile. The Brush, Rectangle and Fill all paint turned, the Line turns each cell its own way, and undo takes turns back with the tiles. TileTurns.Pointing(way) is the turn that points a tile drawn pointing right that way, and TileTurns.Corner(in, out) a corner’s.
  • The turns are a grid of their own, the tilemap’s Turns, a line a row lined up with Tiles: . as drawn, 1, 2 and 3 turned a quarter, a half and three quarters clockwise, and 4 to 7 the same mirrored left to right first (4 mirrored, 6 upside down). A map that turns nothing has no Turns at all, and saves as it did before turns.
  • From scripts, SetTile(x, y, tile, TileTurn.Turn90) lays a tile turned (plain SetTile lays it as drawn), GetTurn(x, y) says how a cell is turned, SetTurn(x, y, turn) turns the tile already there, and FillRect and FloodFill take a turn too. A TileTurn turns further with Turned() and flips with FlippedX() and FlippedY(), and turn.Apply(direction) turns a direction as the tile is turned: a belt drawn moving right, (1, 0), turned Turn90 moves down, (0, -1).
  • Slope tiles collide turned: flipped left to right (or turned a quarter) a rising slope falls, and one turned so its solid corner is at the top is a solid block. A one-way tile stays open from below whichever way it’s turned. Quarter turns suit square maps; flips and half turns suit every shape.

A Conveyor lays belts on a tilemap’s cells (its Map, or the tilemap it’s on or inside, else the scene’s first) and carries items along them: a factory’s lines from machine to machine. Each row of its Belts is a cell, its column and row (row 0 at the top, as a grid mover counts them), the way it carries and what it is: 4 2 right, 5 2 right crossing, 9 2 down split. Each cell holds one item; items glide along at Speed cells a second while the cell ahead is free and wait in the middle of theirs when it isn’t, so a full end backs the whole line up, a cell apart. A belt that runs into the side of another merges into it, the two taking turns, and a split cell hands what reaches it to the belts leading out of it (ahead, and to either side when that belt points away) in turn, passing over one that’s full: a fork that alternates between two machines, filling the other when one is full. Untick Running (or switch it off with a Switch) and the line stops where it is.

A cell can have a speed of its own, a number after its way in its row: 4 2 right 0.5, 9 2 down split 3. It carries at that many cells a second instead of the conveyor’s Speed, so one conveyor can hold a slow gravity chute dropping onto a fast powered belt. An item changes speed at the edge between two cells (it crosses the half of a cell it’s leaving at that cell’s speed), with no pause at the join, and a fast run feeding a slow one backs up as a full end would. From a script, LayPath(points, speed: 0.5f) lays a run at a speed, SetSpeed(x, y, 2) sets one cell’s (0 gives it the conveyor’s again), SetRunSpeed(x, y, 2) sets the run through a cell (the cells leading into it and on from it one to one, up to a merge, a splitter or a cell of another speed; RunThrough(x, y) lists them) and SpeedAt(x, y) reads one. Turning a cell with Lay keeps its speed. Lines of several speeds still play out the same at any game speed and rewind exactly; a tunnel under an under cell goes as fast as the belt leading into it, and Moving Arrows and Belt Tiles step at each cell’s own speed.

Give the conveyor a Spacing and items glide on smoothly several to a cell, as on a factory game’s belts, rather than a cell apart: with 0.25 each follows a quarter cell behind the one ahead, so a cell carries up to four. Items move on while there’s room ahead and close up behind whatever stops them, so the end of a full belt, or one into a machine that’s full, fills with a pile packed a quarter cell apart, the first waiting an eighth of a cell short of the end. They round corners along the belt, and a belt merging from the side slots its items in between, taking turns. Spacing 0 (the default) keeps one item to a cell, each waiting in its cell’s middle.

With a spacing, three more things work:

  • An under cell (5 4 right under) is a belt with a tunnel beneath it: its own items carry on its way, and a belt that runs into its side carries its items straight under it to the cell beyond, neither line waiting for the other. Items in the tunnel are hidden under the belt, and walkers cross an under cell as they do a crossing.
  • A closed loop of belts keeps going round when it’s full: it takes in no more than it holds packed (a belt merging in waits), and every item on it moves on together.
  • Put puts an item in a cell’s middle if none is nearer than the spacing, ItemsAt(x, y) lists every item on a cell (furthest on first), and Positions gives every item’s cell and where it is in the world. ItemAt, Take and ItemPosition mean the one furthest on. Items rows give an item between cells’ middles a part column or row: 4.25 2 Deck is a quarter cell right of (4, 2)’s middle.

Filters, under Splitters, say which items a splitter sends which way: each row is a belt leading out of a splitter and the items it takes, e.g. 10 4 Deck, Box (Deck lets Deck 17 by). An item goes to the belts whose filter names it, else to those with none, in turn; one with nowhere to go waits in the splitter’s middle. From a script, Filter(10, 4, "Deck") sets one and Filter(10, 4, null) takes it off. Filters work with one item to a cell too.

Moving Arrows (under Look) slides Show Belts’ arrows along with the items, and Belt Tiles names a tilemap whose animated tiles are belt art (a layer of its own, say): its runs step with the belt instead of with time, a run’s frames making up one cell of travel, so painted belts move exactly as fast as the items and stop when the line stops.

A Conveyor Port is where a machine meets the belts, at the cell it stands on, so put one on the machine or on an entity inside it where its way in or out is, and the machine’s prefab brings it along. An In port takes what reaches the end of a belt pointing into its cell (or ending on it); an Out port puts items on the belt on its cell, or on one next to it that leads away. They take into and give from the machine’s Inventory: an In port with Items Deck and Holds 2 takes decks until the machine holds two and then leaves the next waiting, so the line backs up behind it, and an Out port with Items Report puts the machine’s reports on the belt as there’s room. An Out port’s Holds is the tray of a machine whose script hands it items: with Holds 6, Give takes up to six waiting for room on the belt and then returns false, and the port is Full until one goes on, which the machine can wait for. An item a port won’t take (the wrong item) waits at the end and the port is Blocked, as is an Out port with nowhere to put what it has: what a machine’s blocked lamp can show. A port’s Message is sent with the item for each it takes or puts, so a Counter can count a line’s throughput.

From a script, LayPath([(2, 4), (9, 4), (9, 8)]) lays a belt along row 4 and down column 9 (its corners are the points; the last cell carries on the way the one before it does, or the lastWay given), Lay(5, 4, 1, 0, ConveyorCellKind.Crossing) turns or lays one cell, and Remove(x, y) takes one up. Put(x, y, "Deck") puts an item in a cell’s middle (false if it’s taken), Take(x, y) takes one off, ItemAt, IsWaiting (backed up there) and ItemPosition read a cell, and Contents lists everything on the line. ReachedEnd is raised for each item that gets to an end with nothing to take it, for a worker to carry it off. A port’s Received and Sent say what it took and put; Give("Report") hands an Out port an item to put on as soon as there’s room, Withdraw("Report") takes one it’s still holding back (for a worker’s cart instead, or when the belt is taken up; it’s never sent) and Clear() takes back all it holds, and its Accepts has a say in what an In port takes. Without an inventory, an In port takes everything for a script listening to Received.

While it’s Solid (the default), belts and splitters are walls to grid movers: a worker sent somewhere with WalkTo goes round them as round a machine, and crosses only at a crossing. Give it a Layer (Obstacle) for movers with Blocking Layers, or untick Solid to let them walk over. Items move in fixed steps of game time, so a line plays out the same at any speed: at 16x (a Game Speed, Time.FastForward or Time.Scale) every item is where it would be at 1x after the same game time, and a rewind puts each back where it was, partway between cells. The conveyor draws its items itself, a quad each (in Item Color, or the image or color Item Images gives it: Deck: Sprites/deck.png, Report: #FFA300; “Deck 17” looks like “Deck”), so hundreds cost no more than a sprite each, and with Sort By Y each sorts by its own height among the workers. Show Belts draws plain belts with arrows until a tilemap layer draws them.

Belts, pipes, rails and wires go down by dragging a line: from the cell you press on to the one you let go on, along one way and round a corner, each cell pointing the way the line runs. The same rule lays them in the Scene view and in the game. Which leg comes first is the way the drag started (along the row if it first left the start cell across, down the column if it first went down; back on the start cell it starts again), and a key turns the corner the other way round.

Line Tiles on a tilemap say what a line looks like on it: a Straight Tile, drawn running left to right and pointing right, and a Corner Tile, drawn coming in from the left and going out at the bottom (a clockwise turn), each drawn once and laid turned to follow the line (turned tiles); a corner turning the other way is laid mirrored. A Start Tile and End Tile for its two ends are optional.

  • In the Scene view, the Line tool (L) drags out a line on the selected tilemap, its tiles shown faintly as they’ll go down, and lays it as one undo step: the map’s Line Tiles (or the Line Tiles of the map it’s a layer of), or without them the brush’s tile pointing along the line. Z turns a single cell (a click without dragging), or while dragging, swaps the corner; Shift erases the line’s cells and Esc lets go of it. Agents call the Scene view’s PaintLine(fromX, fromY, toX, toY).
  • In the game, a Line Tool (a component, on the camera say) lets the player do the same: press, drag, let go. A see-through ghost shows each cell with an arrow the way it runs, in Ghost Color where it fits and Blocked Color where it can’t, and letting go lays the cells that fit on its Conveyor as belts (Belt Kind) and on its Tiles map with that map’s Line Tiles, then raises Placed with them and sends its Message. R (the built-in Rotate action, rebindable in Game → Controls) turns a single cell’s Way, or swaps the corner while dragging; a right-click (Command) drops the line. Untick Corners for straight lines only, along whichever way it’s dragged further (a wall tool), and pick First Leg Longer to put the corner by the way it’s dragged further instead.
  • A cell can’t take the line off the map (Stay On Map), on a wall (Blocked By Walls: solid tiles and solid colliders, on Blocking Layers if given, and other conveyors’ solid belts; not its own conveyor’s, which a line laid over turns), where a grid mover stands (Blocked By Movers), past Max Cells (what the money covers, set by a script), or where a script’s CanLay says no. With no Conveyor or Tiles it lays nothing itself: a script handles Placed (orders to build, the price) and reads Dragging as the line changes, Cells (the ghost, each with Fits), Hover and IsDragging. Line(from, to) checks a line without dragging it, Lay(cells) lays one, and LineDrag.Path(from, to) is the rule itself.
  • While a Line Tool’s Controllable is ticked it has the mouse and Selection Controls leave it alone; untick it when another tool is picked (its Focus action does both).
  • Tick a Line Tool’s Joins to join a line onto those already laid (its Conveyor’s belts, or with no Conveyor its Tiles’ pieces), as extending a belt or adding a branch does. Dragged from a line’s end (or the cell an end runs into), it carries that line on: the old end turns to feed it, keeping its kind and speed, and its tile becomes a straight piece or a corner, so the two make one line with one start and one end. Ended on a line’s side (or its start), it merges in: that belt stays as it is and the cell before it points into it; a line ending beside one, pointing in, feeds it the same way, with a straight piece rather than an end. Dragged out of a line’s side, it splits off: that belt becomes a splitter, keeping its way, handing items to both. The ghost shows a belt it merges into or splits off smaller, with its own arrow, and Placed leaves out a belt it merges into (it isn’t laid). Belts the line crosses on the way are laid over and turned, as without Joins. The Line Tiles’ optional Join Tile (a straight piece with a line coming in from the bottom) and Split Tile (with a line going out at the bottom) show a merge and a split; without them that cell keeps its piece. In the Scene view, tick the Line Tiles’ Joins for the Line tool to join lines the same way. Scripts call LineDrag.Join(line, wayAt), the tool’s Join(cells) or the Line Tiles’ Join(cells), and read each cell’s Join (Continues, Feeds, Merge, Split).
var tool = Find("Main Camera").GetComponent<LineTool>();
tool.CanLay = cell => !Zones.Has(cell.Cell);
tool.MaxCells = Money / 40;
tool.Placed += (_, cells) => { foreach (var c in cells) OrderBelt(c.Cell, c.Way); Money -= 40 * cells.Count; };