Hazel

Tilemaps

A tilemap lets you paint a 2D level from a tileset, one cell at a time, on a square, isometric or hexagonal grid. Everything happens in the Tilemap panel and the 2D view.

Every painted tile is an ordinary sprite. Tiles show in the Hierarchy, and they select, move, save and load like any sprite you placed by hand.

Making a tilemap

Drag a tileset image from the Assets panel onto the Tilemap panel. An overlay confirms the drop, and you get one tilemap per image, named after the file. Dropping a tileset that is already imported just switches to it.

There is no Add Entity entry for tilemaps: the panel is where they are made.

Tileset images are always drawn with crisp, nearest-pixel filtering, so pixel art stays sharp and tiles never bleed into their neighbours.

A folder of tile images

Many packs, isometric ones especially, ship each tile as its own file instead of one sheet. Drag the folder onto the panel instead. The palette becomes every image in the folder and its subfolders, shown as thumbnails; click one to make it the brush.

  • The new tilemap's tile size is the width most of the images share, and its layout is the 2D view's grid shape at the time. Switch the view to isometric or hex before dropping a folder drawn for that grid.
  • Each image paints at its own size, so a pack can mix flat floors with tall walls.
  • The list of images is saved with the tilemap. After adding files to the folder, click Refresh above the thumbnails. Tiles already painted keep their image.
  • A folder palette paints one image at a time. Multi-tile objects and terrains need a single tileset image.

Several tilemaps in a scene

A tab strip at the top of the panel lists every tilemap in the scene. Click a tab to make it the one you paint on; click it again to deselect it. Selecting a tilemap in the Hierarchy does the same. You don't have to keep it selected while you paint.

Each tilemap is a normal entity: rename it, move it to shift the whole map, hide it or delete it. Its settings are on its Tilemap Layer card in the Inspector:

FieldWhat it does
Tile SizeThe width of one cell, in world units. Default 16.
Atlas Tile PxThe size of one tile in the tileset image, in pixels. Default 16.
ColumnsHow many tiles across the tileset image is.
LayoutSquare, Isometric, Hex Pointy or Hex Flat.
Tile HeightThe cell's height. 0 means the usual shape for the layout (half the width for isometric, a regular hexagon for hex).
Tile Offset X / YNudges every tile's picture, for packs whose art does not sit exactly on the cell.

Paint layers

Under the tab strip is the layer list. The top row draws on top. Every tilemap starts with one layer, Base; click Add Layer for more.

  • Click a row to paint on that layer. Strokes only touch the selected layer, so decoration on an upper layer never wipes the ground under it.
  • The eye hides a layer, and the lock protects it from painting and erasing.
  • The up and down carets move a layer up or down the stack.
  • While painting, the status bar says where your strokes go, such as Painting: Level / Base.

Layers are children of the tilemap in the Hierarchy, in the same order, and that order is the draw order. You can also add one with the New Tile Layer button at the bottom of the Hierarchy.

Picking a brush

The palette shows the tileset. Click a tile to pick it, or drag to pick a block. Ctrl+Click toggles single cells and Shift+Click adds them, for an odd-shaped pick such as a tree's canopy without the bushes beside its trunk.

Zoom the palette with the wheel or the - and + buttons, pan it with right-drag, and turn on Grid to see tile boundaries.

Picking tiles switches the viewport's Mode dropdown to Paint. Over the 2D view, Tab swaps between Select and Paint and Esc goes back to Select.

Painting

In Paint mode a see-through copy of your brush follows the cursor, snapped to the grid, showing exactly what a click will place.

ActionWhat it does
Left-dragPaint. A fast drag never skips cells.
Shift and dragFill a rectangle.
Alt and dragErase.
Right-clickPut the brush down and go back to Select.

Painting over a tile replaces it. Right-drag still pans the view.

The Erase mode in the Mode dropdown makes every drag erase. In it, the cursor outlines in red exactly the tile a click will remove, going by the visible picture, so pointing anywhere on a tall wall panel erases that panel.

Tools

The row of buttons under the panel's header picks what a drag does. The same tools appear on the viewport's tool strip while the 2D view has a tilemap, so you can switch without leaving the view.

ToolKeyWhat it does
BrushBPaint where you drag.
LineDrag from one cell to another to paint a straight line.
RectangleDrag a box to fill it.
FillClick a tile to replace every connected tile of the same kind, or click an empty cell inside a painted area (the floor inside a room's walls) to fill it.
PickerIClick a painted tile to make it the brush.
SelectMDrag a box of cells to copy, cut, paste or delete (below).
TerrainPaint a terrain whose edges and corners pick themselves (see Terrains).

Shift still makes any drag a rectangle and Alt still erases, whatever the tool.

The last buttons turn and mirror the brush: Rotate turns it a quarter clockwise (Z), and the two flip buttons mirror it. They stay set until you change them, so you can lay a run of corners without re-flipping each one.

Copying part of a level

With Select, drag a box over the cells you want, then:

KeyWhat it does
Ctrl+CCopy the tiles in the box.
Ctrl+XCopy them and clear the cells.
DeleteClear the cells.
Ctrl+VPick up the copy. Each click stamps it with its top-left on the clicked cell.
EscPut the copy down; press again to clear the box.

Pasted tiles keep their flips, tint and collision. Each cut, delete and stamp is one undo step.

Multi-tile objects

Pick more than one tile in the palette and painting places one object, not a pile of cells. A tree or a house is a single sprite: it selects, moves and erases as one. Objects come with Y Sort already on, sorting at their bottom edge, so a character walks behind the canopy and in front of the trunk without any setup.

Randomise

Painting a block of trees gives an obviously tiled grid. Randomise (the dice on the viewport toolbar) turns it into a natural scatter:

  1. Paint or rectangle-fill a block of trees.
  2. Switch to Select and select them.
  3. Click the dice.

Each selected tile moves to a random cell inside the selection's own area, leaving gaps and clusters. Click again for a different layout.

Terrains

A terrain is a set of tiles that draw one kind of ground (grass, water, a cliff), each marked with which neighbours it is drawn for. Paint with it and every cell shows the right edge, corner or fill on its own, and its neighbours adjust as you go.

Setting one up

The Terrains row sits under the tool row.

  1. Click + Terrain, give it a name and pick a mode: Corners and sides (matches all eight neighbours, for the common 47-tile and 3 by 3 layouts) or Sides only (matches four sides, for a 16-tile layout).
  2. The quick way to fill it: turn editing off (the pencil), select the terrain's 3 by 3 block in the palette (outer corners, edges and fill), and click Assign from block (the four-squares button). Every tile gets the neighbours its place in the block implies.
  3. For other tiles such as inner corners, turn editing on and click on a palette tile: its middle adds or removes it from the terrain, an edge or corner toggles whether it joins the neighbour on that side.

The terrain's tiles are marked in blue over the palette.

Painting with a terrain

Click a terrain's chip. That also picks the Terrain tool. Left-drag paints and the cells around re-pick their tiles; Alt and drag (or Erase mode) removes cells and closes the edges around them.

When no tile matches a spot exactly, the closest one is used, so a terrain with only its 3 by 3 block still paints sensibly. When several tiles match equally, they are treated as variants and spread over the map. Terrains work on square and isometric maps.

Collision

Mark tiles as solid in the palette and every painted copy of them collides: walls, cliffs, water edges, without placing a collider by hand.

  1. Select the solid tiles in the palette.
  2. Click the wall button in the panel header. The marked tiles tint red.

Click again with the same tiles selected to unmark them. Touching solid tiles merge into larger colliders, so characters never snag on the seams. Colliders rebuild whenever you paint, and the exported game builds them the same way.

Tile shapes and one-way tiles

With one solid tile picked, two more controls appear beside the wall button:

  • Shape: Full, Top half, Bottom half, Left half, Right half, Slope up right, Slope up left, Ceiling slope right or Ceiling slope left.
  • One-way (the up arrow): the tile can be stood on from above and passed through from below and the sides, for platforms you jump up onto.

A tile painted turned or mirrored has its shape turned or mirrored too, so one slope tile serves both directions.

Collision for objects

A multi-tile object gets its own collider instead:

  1. Pick the object in the palette.
  2. Click the wall button. A green box covers the object.
  3. Drag its handles or its middle, for example down to the base of a tree's trunk.
  4. Pick Box, Circle or Capsule beside the wall button.

Every object you paint from then on carries that collider. Objects painted earlier keep the one they had; fix those with the collider Edit button in the Inspector (see 2D colliders).

Isometric tilemaps

Set Layout to Isometric and the tilemap paints diamonds. Every tool works the same. Each tile's picture stands with its bottom centre on its diamond's lowest point, so a tall tile (a wall, a thick floor block) rises above its cell, and tiles nearer the viewer draw in front.

Dropped folders line up on their own. When you drop a folder while the 2D grid is isometric or hex, the tilemap reads from the images where the pack's art stands: floor slabs are lifted so their bottom sits on the grid, and wall panels are slid along their slope until their face runs along one cell edge. You can still change the values it picks.

Offsets per image. Packs often draw a floor centred but a wall lower and to one side, so one Tile Offset can't suit both. With a folder palette, click an image and set Offset X / Y above the thumbnails; every tile painted with that image moves. The copy button beside the fields gives the same offset to every image named the same up to its last _, so Wall_L_32_Brick sets all of Wall_L_32_*.

Walls. Paint a back-left wall in the row just behind the floor's back-left edge, and a back-right wall in the column just behind its back-right edge. Each wall then sorts behind the floor it stands on.

Tall walls. To raise a wall, paint it on its own paint layer and set that layer's Tiers in the Inspector: 3 stacks two more copies on top of every tile, Tier Step world units apart. Furniture in front of a tall wall still draws over all of it.

Set the 2D view's grid to Isometric with the tilemap's tile size so the grid lines match the cells.

Hex tilemaps

Set Layout to Hex Pointy (point at the top, in rows) or Hex Flat (flat top, in columns). Tile Size is the hexagon's width and Tile Height its height; pixel-art hexes are often not regular, so set the height to your tiles' drawn height.

Painting, lines, rectangles, Fill and copy and paste all work on hexagons. Each solid hex gets its own hexagonal collider. Terrains and the half and slope collision shapes are for square and isometric maps.

How tiles are saved

Every painted tile is a child of its layer, named Tile (x, y) for a single cell and Object (x, y) for a multi-tile object, and is saved with the scene. The tileset is stored as a path inside the project, so the project moves between machines intact.