New: 36 free tools for Unreal Engine and Unity developers.Try them →

How to Make Autotiles for Unity Tilemaps (Rule Tiles)

Draw a small autotile template, generate a 47-tile set, slice it in Unity and build a Rule Tile that paints terrain with the right edges and corners.

In this article
  1. Step 1: draw the template
  2. Step 2: generate the 47 tiles
  3. Step 3: import the sheet into Unity
  4. Step 4: create the Rule Tile
  5. Step 5: paint
  6. Troubleshooting
  7. Summary
  8. FAQ

Painting terrain tile by tile, choosing the right edge and corner for every cell, gets old fast. Unity's Rule Tiles do it for you: paint with one brush and the edges, corners and inner corners appear automatically. The hard part is the tileset itself. This guide takes you from a small hand-drawn template to a working Rule Tile.

If you want to understand the theory first, read What Is a 47-Tile Blob Tileset?.

Step 1: draw the template

Instead of drawing 47 tiles, draw a small template in the RPG Maker A2 layout: 2 tiles wide and 3 tiles tall. For 32-pixel tiles that is a 64 × 96 image.

  • Top-left tile: the terrain as a single isolated tile.
  • Top-right tile: solid terrain with a small cut-out at each of its four corners (the inner corners).
  • Bottom 2 × 2 tiles: one rounded patch of terrain: outer corners, edges and fill.

Use an even tile size (16, 32, 48, 64) so each tile splits into equal quarters, and keep the edges consistent in the middle of each tile, where quarters meet.

Step 2: generate the 47 tiles

Open the free Autotile Generator and drop in your template (or start from the example template to see the layout). It builds the full 47-tile sheet in an 8 × 6 grid and gives you a canvas to paint shapes and check the result. Download the ZIP: tileset PNG, bitmask JSON and a Unity editor script.

Step 3: import the sheet into Unity

  1. Make sure 2D Tilemap Extras is installed (Package Manager → com.unity.2d.tilemap.extras).
  2. Import the PNG and set:
    • Texture Type: Sprite (2D and UI)
    • Sprite Mode: Multiple
    • Pixels Per Unit: your tile size (for example 32)
    • Filter Mode: Point (no filter) for pixel art
    • Compression: None
  3. Open the Sprite Editor, choose Slice → Grid By Cell Size, enter your tile size and click Slice, then Apply.

Unity names the sprites in order, row by row from the top left: tileset_0 to tileset_46. The empty 48th cell is skipped.

Step 4: create the Rule Tile

Option A: with the generated script

  1. Put TvashtaBlobRuleTile.cs from the ZIP into an Editor folder.
  2. Right-click the sliced texture and choose Create → Tvashta → Rule Tile From 47-Tile Sheet.
  3. A Rule Tile asset is created next to the texture with one rule per tile.

Option B: by hand

  1. Create → 2D → Tiles → Rule Tile.
  2. Set the Default Sprite to the fully surrounded tile.
  3. Add a rule for each tile and set the 3 × 3 neighbour grid: a green arrow for "this tile", a red cross for "not this tile", empty for "don't care". Use the bitmask JSON to see which neighbours each tile expects.

Option B is slow for 47 rules, which is why the script exists. Check a few rules by hand either way, so you understand what it built.

Step 5: paint

  1. Create a Tilemap (GameObject → 2D Object → Tilemap → Rectangular).
  2. Open the Tile Palette, create a palette and drag the Rule Tile into it.
  3. Paint. Edges, outer corners and inner corners update as you draw.

Troubleshooting

  • Wrong tiles in some places: the sprites were sliced in a different order, or the sheet was resized. Re-slice with the exact tile size.
  • Lines between tiles: use Point filtering and no compression; set Pixels Per Unit to the tile size.
  • Menu item missing: the script must be in a folder named Editor, and the 2D Tilemap Extras package must be installed.
  • Seams in the middle of tiles: the template's edges do not match where quarters meet. Fix the template and regenerate.

Summary

  • Draw a 2 × 3 template instead of 47 tiles.
  • Generate the 47-tile sheet, slice it in Unity by cell size.
  • Build the Rule Tile with the script or by hand, then paint on a Tilemap.

Frequently asked questions

What is a Rule Tile in Unity?

A Rule Tile is a tile asset from Unity's 2D Tilemap Extras package. It holds a list of rules that check the neighbouring cells and choose which sprite to show, which is how Unity does autotiling.

How do I install Rule Tiles in Unity?

Install the 2D Tilemap Extras package (com.unity.2d.tilemap.extras) from the Package Manager. It is included in many 2D project templates.

Why are there gaps or lines between my tiles?

Usually filtering or compression. Set Filter Mode to Point and Compression to None, make Pixels Per Unit equal to the tile size, and use a Sprite Atlas with padding if you pack tiles together.

Can I use the same tileset in Unreal Engine?

Yes. Create a Paper2D Tile Set from the PNG with the same tile size. Paper2D has no Rule Tiles, so apply the bitmask lookup in your own code.

  • #unity
  • #2d
  • #tilemaps
Written by Renish

Indie Unreal Engine developer and founder of Tvashta Studio. Builds the Shopping Simulator Kit plugin in UE5 C++ and the free tools on this site, and writes these guides from that work for Unreal Engine and Unity developers. More about the studio.

Related articles

All articles →