Skip to content

Painting

This page covers painting, erasing and copying tiles in the Scene view, using the Paint tab of the map inspector and the RPG Map Editor overlay. It also explains which layer a tile ends up on, because that is what surprises people most.

Concept

You paint on a map that has both of its assets assigned and loaded: a Tileset for the art and a Map Data asset for the tiles. Getting Started walks through creating them.

Select the AutoTileMap GameObject, open the Paint tab in its inspector and press Edit. Painting is now on. Clicks in the Scene view go to the brush instead of Unity's selection, so clicking a character on the map no longer selects it. Pick it in the Hierarchy instead.

When you are done, press Commit. That writes the tiles into the Map Data asset and turns painting off. Saving and Loading explains what happens if you forget.

Every tile you paint goes onto one of the map's layers. Which one depends on the selected layer, the tile itself, the Smart Brush toggle and whether you hold Shift. The rules are further down this page, under Which layer a tile lands on.

The Paint tab

The Paint tab with painting on: Commit, the layer list, Smart Brush and the palette

With painting off, the tab shows only the Edit button and a reminder to commit. With painting on, it shows these, top to bottom:

Control What it does
Commit Saves the tiles into the Map Data asset and turns painting off.
Uncommitted changes box Appears while tiles have changed since the last save, and names the Map Data asset they will go to.
Selected Layer: <name> The layer the brush paints on. Click a row of the layer list to change it.
Map Layers The layer list. Layers covers every column.
Clear Selected Layer: <name> Empties the selected layer after a confirmation dialog. Ctrl + Z does not bring it back.
Smart Brush On by default. Sends tiles with transparency or overlay collision to a higher layer. The box under the toggle says what it will do.
Tileset: Chooses which sub-tileset the palette shows.
Palette The tiles of that sub-tileset.

Painting is one switch for the whole editor, not one per map. It turns itself off whenever scripts recompile. Your tiles are saved before the recompile, so nothing is lost; press Edit again to carry on.

Picking tiles in the palette

The palette draws every tile 32 pixels wide, eight to a row, whatever the tile size of your tileset.

  • Left click a tile to select it. A white frame marks it and the overlay shows its number as Selected Tile Id.
  • Right click and drag over several tiles to select a rectangle. When you let go, the rectangle becomes the brush, and a translucent copy of it follows the mouse in the Scene view.

A single tile has no preview in the Scene view. Watch Brush Pos in the overlay to see which cell you are over.

Each tile in a palette rectangle gets its layer at the moment you release the button, from the selected layer and Smart Brush at that time. Select the layer first, then pick the rectangle.

Editing collisions from the palette

Hold Shift and the palette switches to collision editing. Each tile shows its collision symbol, and a legend replaces the usual hint. While Shift is held, a left click on a tile moves it to the next collision type and a right click moves it back.

Collisions are stored in the tileset asset, so a change here affects every map that uses the same tileset. Tile Collisions explains the types.

The RPG Map Editor overlay

The RPG Map Editor overlay in the Scene view

The Scene view gets an overlay called RPG Map Editor while an AutoTileMap is selected. Select anything else and it goes away. You can drag it, dock it or collapse it like any other Scene view overlay.

Item What it shows
Brush Pos Column and row of the cell under the mouse. 0, 0 is the top-left cell of the map and the row number grows downwards.
Selected Tile Id The id of the tile last picked in the palette or with a right click. It reads -2 after a Shift right click, because that copy is not a single tile.
Tool buttons Only shown in the Paint tab with painting on. Otherwise the overlay says Press Edit in the Paint tab to paint.
Brush Size How many times the brush repeats across and down, from 1 to 16. At 3 a single tile paints a 3 by 3 square, and a copied block of 2 by 2 tiles paints a 6 by 6 area. A white outline shows the area under the cursor. Kept between sessions.
Help (F1) A foldout with a summary of the mouse and keys. F1 in the Scene view opens and closes it too.

The tool buttons have no text. Hover them for their tooltips:

Tooltip What it does
Paint (B) Picks the pencil, leaves erase mode and paints the tile selected in the palette, as a click in the palette does, through Smart Brush. In 1.6.1 it ignored Smart Brush and always painted on the selected layer.
Erase Turns the brush into one empty cell on the selected layer. Only that layer is cleared. The fill, line, rectangle and ellipse erase too while it is on.
Fill (G) A click paints the brush over every tile connected to the one you click, through their sides, that holds the same tile on the selected layer. While you hover, the area it would fill is shaded.
Line (L) Drag from one end to the other. The line is painted when you release the button.
Rectangle (R) Drag corner to corner to draw the outline of a rectangle.
Filled Rectangle (R twice) The same, filled. Pressing R while the rectangle is chosen switches between the two.
Ellipse (E) Drag corner to corner to draw the outline of an ellipse.
Filled Ellipse (E twice) The same, filled.
Undo (Ctrl + Z or Shift + Z) Undoes the last stroke, like Edit > Undo. Dimmed when there is no painting to undo.
Redo (Ctrl + Y or Shift + Y) Redoes it. Dimmed when there is no painting to redo.
Display Help (F1) Opens or closes the help foldout.

Erase mode ends as soon as you pick a tile in the palette or right click in the Scene view.

If the map has not finished loading, the overlay shows The map is not loaded yet. and nothing else.

Mouse and keys

These work in the Scene view while painting is on.

Action How
Paint Left click, or left drag to paint every cell the mouse crosses.
Paint one layer up Shift + left click or drag.
Copy one cell Right click.
Copy a rectangle Right drag, then release.
Copy only the layers above the selected one Shift + right click or drag.
Pick the pencil, fill, line, rectangle or ellipse B, G, L, R, E (R and E again for the filled shape)
Draw a square or a circle Shift while dragging a rectangle or an ellipse
Draw a shape from its centre Ctrl while dragging (Cmd on a Mac)
Cancel a shape Esc before releasing the button
Fill one layer up Shift + click with the fill
Undo the last stroke Ctrl + Z or Shift + Z
Redo it Ctrl + Y or Shift + Y
Show or hide the help F1
Pan the view Middle mouse button.
Zoom Mouse wheel.

Apart from Ctrl+Z and Ctrl+Y, Ctrl does nothing in the Scene view. The in-game editor uses its own set of keys, listed on In-Game Map Editor. Every shortcut in the asset is on Keyboard and Mouse.

Which layer a tile lands on

The brush does not always paint on the selected layer. With Smart Brush on, a single tile from the palette goes to an Overlay layer if its collision type is Overlay, to the layer above the selected one if it has transparent pixels, and to the selected layer otherwise. Shift sends a single tile to the layer above whether Smart Brush is on or off. Layers spells out the rules and the order they are checked in.

Only the selected layer changes when an opaque tile lands on it. So to change the ground under a tree without erasing the tree, select the ground layer and paint an opaque terrain tile over it.

Warning

The brush never paints on a hidden layer, an Objects layer or a Fog Of War layer. When a tile should go to the layer above and that layer is one of those, or the selected layer is the top one, the tile is not painted at all. Select a lower layer, or turn Smart Brush off.

A brush of several tiles

A rectangle from the palette or a copy from the map carries a layer for each of its tiles, and paints them there.

  • A palette rectangle follows the Smart Brush rules tile by tile, measured from the layer that was selected when you picked it. Shift plays no part at that point.
  • A copy from the map puts every tile back on the layer it came from. Empty cells are copied too, so pasting can clear tiles on those layers where you paint.

Hold Shift while you paint a multi-tile brush and the tiles meant for the selected layer go on the layer above instead. Empty cells then stop clearing that layer.

Copying from the map

Right click a cell to copy it. The copy holds that cell's tiles on every visible Ground and Overlay layer. Right drag to copy a rectangle; a green frame shows the area, and the brush is ready when you release the button.

The cell where you released the button is the one that follows the mouse when you paint, so the copy lines up with the corner you finished on.

Shift + right click, or Shift + right drag, copies only the layers above the selected layer. Use it to copy a tree without the grass under it: select the ground layer, then Shift + right drag over the tree. Empty cells on Overlay type layers come along in the copy. Empty cells on Ground type layers are left out, so the copy does not clear the ground where you paste it.

Undo and redo

Painting is part of Unity's undo. Ctrl + Z (Cmd + Z on a Mac) undoes the last stroke and Ctrl + Y redoes it, and every stroke shows as Paint Tiles in Edit > Undo History. A stroke is everything from pressing the mouse button to releasing it, so one undo takes back a whole drag.

Shift + Z and Shift + Y, and the two overlay buttons, do the same as Ctrl + Z and Ctrl + Y. Like them, they undo whatever was done last in the editor, which is not always painting.

  • The history survives a script recompile. It holds the last 200 strokes.
  • Clear Selected Layer, Clear Map... and Generate Map... are not part of it.
  • The in-game editor keeps its own history, see In-Game Map Editor.

Uncommitted changes

While tiles differ from what the Map Data asset holds, the Paint tab shows:

Uncommitted changes. Press Commit to save them into '<Map Data name>'. They are also saved when scripts recompile, the scene closes or play mode starts.

Commit is the way to be sure. Some actions reload the map from the asset and throw away uncommitted work, Reload Map among them. Saving and Loading lists them.

Fill and shapes

The fill and the shapes paint whatever the brush holds: the tile picked in the palette, a block copied with a right drag, or nothing in erase mode. A copied block repeats across the area by map position, so the copies line up with each other. Each fill or shape is one step for Ctrl + Z.

The fill compares tiles on the selected layer only. It stops at any tile that differs from the one you clicked, including the edge of the map. On a big area it can take a moment; if it runs past five seconds it asks whether to keep going.

The fill tool hovering over a patch of tall grass, with the area it would fill shaded

While you drag a shape, the tiles it will paint are shaded the same way, and nothing is painted until you let go. This rectangle is drawn with Brush Size at 2, so its outline is two tiles thick.

A rectangle being dragged over the same patch with Brush Size 2

The tool keys work only while you are painting (Edit pressed in the Paint tab). Then R and E pick the rectangle and the ellipse instead of Unity's scale and rotate tools. You can change the keys under RPG Map Editor in Edit > Shortcuts.

Brush Size applies to the pencil, and makes the line and the rectangle and ellipse outlines thicker: each point of the shape paints the area the pencil would paint there. Filled shapes and the fill ignore it.