unity-tilemap-2d
gamedev-skills/awesome-gamedev-agent-skills
Build and script 2D tilemaps in Unity 6.3 LTS with Grid, Tilemap, colliders, and rule tiles.
What is unity-tilemap-2d?
Create tile-based 2D levels in Unity using the Grid and Tilemap components, the Tile Palette, and runtime painting. Use this when laying out tile levels, adding collision, using rule or animated tiles, or generating tilemaps from code.
- Paint and author 2D tile levels using the Grid + Tilemap system and Tile Palette
- Add collision to tilemap layers with TilemapCollider2D and CompositeCollider2D for merged, gap-free physics
- Auto-tile with Rule Tiles so edges and corners pick the correct sprite automatically
- Generate and edit tilemaps at runtime using SetTile, GetTile, and SetTilesBlock with cell coordinates
- Convert between world and cell coordinates using WorldToCell and CellToWorld
- Manage multiple tilemap layers with proper sorting and rendering order
How to install unity-tilemap-2d
npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill unity-tilemap-2d- Unity 6.3 LTS (6000.3) installed
- 2D Tilemap Extras package (com.unity.2d.tilemap.extras) installed via Package Manager if using Rule Tiles or Animated Tiles
How to use unity-tilemap-2d
- 1.Create a Grid and Tilemap: GameObject → 2D Object → Tilemap → Rectangular (or Hexagonal/Isometric for other layouts)
- 2.Open the Tile Palette (Window → 2D → Tile Palette) and drag in a sliced sprite sheet to create Tile assets
- 3.Paint tiles onto the tilemap using the Tile Palette brush tools, creating one Tilemap per layer (background, ground, foreground)
- 4.Add collision to solid layers by attaching TilemapCollider2D, then add CompositeCollider2D with a static Rigidbody2D for merged, gap-free colliders
- 5.Use Rule Tiles (from 2D Tilemap Extras) to auto-tile edges and corners instead of hand-placing every variant
- 6.Edit tilemaps at runtime using SetTile(cell, tile) and GetTile(cell) with Vector3Int cell coordinates, converting world positions via WorldToCell()
- 7.Call RefreshTile(cell) after script edits to update rule/animated tiles; use RefreshAllTiles() only for full map regenerations
- 8.Test in Play mode to verify collisions, sorting order, and that tiles render correctly
Use cases
- Painting a platformer or top-down level layout with the Tile Palette brush tools
- Adding physics collision to a solid ground layer without performance overhead
- Procedurally generating a dungeon or roguelike room by bulk-filling tiles from script
- Auto-tiling a level so corner and edge sprites update automatically based on neighbors
- Editing the tilemap at runtime (e.g., destructible terrain or dynamic level changes)
- 2D game developers building tile-based levels in Unity
- Level designers using the Tile Palette to paint and iterate on layouts
- Programmers generating or modifying tilemaps procedurally or at runtime
- Game developers working on platformers, roguelikes, or top-down tile-based games
unity-tilemap-2d FAQ
RuleTile is not built in; it lives in the separate 2D Tilemap Extras package (com.unity.2d.tilemap.extras). Install it via Package Manager before using RuleTile.
Do not use one collider per tile. Instead, add a CompositeCollider2D with a static Rigidbody2D and enable 'Used By Composite' on the TilemapCollider2D to merge the entire layer into one smooth, efficient collider.
SetTile places a single tile at a cell; SetTilesBlock fills a whole rectangular region (BoundsInt) in one call, which is much faster for procedural generation or bulk edits.
Call RefreshTile(cell) after edits to re-evaluate that cell's rules. Avoid RefreshAllTiles() for small edits—it re-evaluates the entire map and stalls large levels. Reserve it for full regenerations.
Use tilemap.WorldToCell(worldPos) to get the cell, and tilemap.CellToWorld(cell) to get the world position. SetTile and GetTile always take Vector3Int cell coordinates, not world positions.
Full instructions (SKILL.md)
Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.
name: unity-tilemap-2d description: > Build and script 2D tilemaps in Unity 6.3 LTS: the Grid + Tilemap components, the Tile Palette, tilemap colliders, rule tiles, and runtime SetTile/GetTile painting. Use when painting tile levels, adding a TilemapCollider2D, using rule or animated tiles, generating tilemaps from code, or when the user mentions Unity tilemap, tile palette, rule tile, or Grid.
Unity 2D Tilemap
Author and script tile-based 2D levels in Unity 6.3 LTS with the Grid/Tilemap system, the Tile
Palette, colliders, and runtime painting. Targets Unity 6.3 LTS (6000.3).
Package note: the core Tilemap (
Grid,Tilemap,Tile,TilemapCollider2D) is built in. Rule Tiles, Animated Tiles, and Tile Palette brushes live in the separate "2D Tilemap Extras" package (com.unity.2d.tilemap.extras) — install it via Package Manager before usingRuleTile.
When to use
- Use when laying out a 2D level by painting tiles, setting up a
Grid+Tilemap, adding collision to the map, using auto-tiling Rule Tiles, or generating/editing tiles from script. - Use when scenes contain a
GridwithTilemapchildren, or*.assettile/palette files.
When not to use: level design practice (pacing, blockout, layout principles) →
level-design. 3D tile/grid placement → Unity's own 3D tooling (ProBuilder / grid brushes; no dedicated skill here). The platformer character that
moves over the tiles → platformer / unity-physics.
Core workflow
- Create the grid: GameObject → 2D Object → Tilemap → Rectangular (the
Grid's Cell Layout also offers Hexagonal and Isometric for hex/iso levels). This makes aGridwith a childTilemap(+TilemapRenderer). Use one Tilemap per layer (background, ground, foreground) and set each renderer's sorting. - Open the Tile Palette (Window → 2D → Tile Palette), drag in a sliced sprite sheet to
create
Tileassets, then paint with the brush tools. - Add collision to the solid layer:
TilemapCollider2D. For one merged collider (far cheaper and gap-free), also addCompositeCollider2D(+ aRigidbody2Dset to Static) and enable Used By Composite on the tilemap collider. - Auto-tile with Rule Tiles (2D Tilemap Extras) so edges/corners pick the right sprite automatically instead of hand-placing every variant.
- Edit at runtime via script with cell coordinates (
Vector3Int):SetTile,GetTile,SetTilesBlock, converting world↔cell with theGrid/Tilemap. - Verify in Play mode: confirm collisions (Physics Debugger), sorting order, and that
RefreshAllTilesran after bulk edits.
Patterns
1. Painting tiles at runtime (cell coordinates)
using UnityEngine;
using UnityEngine.Tilemaps;
public class TilePainter : MonoBehaviour
{
[SerializeField] private Tilemap tilemap; // assign the target Tilemap
[SerializeField] private TileBase groundTile;
// World position -> cell, then place a tile.
public void PaintAt(Vector3 worldPos)
{
Vector3Int cell = tilemap.WorldToCell(worldPos);
tilemap.SetTile(cell, groundTile);
}
public bool IsSolid(Vector3 worldPos)
=> tilemap.GetTile(tilemap.WorldToCell(worldPos)) != null;
}
2. Bulk fill a region (faster than per-cell SetTile)
// SetTilesBlock writes a whole BoundsInt in one call — use it for procedural rooms/floors.
public void FillFloor(Tilemap map, TileBase tile, int width, int height)
{
var bounds = new BoundsInt(0, 0, 0, width, height, 1);
var tiles = new TileBase[width * height];
for (int i = 0; i < tiles.Length; i++) tiles[i] = tile;
map.SetTilesBlock(bounds, tiles);
}
3. Clearing and refreshing
tilemap.SetTile(cell, null); // null erases the tile at that cell
tilemap.RefreshTile(cell); // re-evaluate just this cell's rule/animated neighbors (cheap)
// RefreshAllTiles() re-evaluates the ENTIRE map — reserve it for full regenerations, not per-edit.
Pitfalls
RuleTiletype not found — it's not built in. Install the 2D Tilemap Extras package (com.unity.2d.tilemap.extras) via Package Manager.- A collider per tile tanks performance / leaves seams — add a
CompositeCollider2Dwith a staticRigidbody2Dand Used By Composite to merge the whole layer into one smooth shape. - Confusing world and cell coordinates —
SetTile/GetTiletake aVector3Intcell, not a world position. Always convert withWorldToCell/CellToWorld. - Tiles render behind/in front of sprites unexpectedly — set each
TilemapRenderer's Sorting Layer and Order in Layer; multiple tilemaps need explicit ordering. - Rule/animated tiles don't update after script edits — refresh after writes, but prefer
the targeted
RefreshTile(cell)for a few edits;RefreshAllTiles()re-evaluates every tile on the map and stalls large levels. Reserve the full refresh for whole-map regenerations. - Painting onto the wrong layer — the active target Tilemap in the Tile Palette determines where paint lands; check the "Active Tilemap" dropdown.
References
- Primary docs: Unity Manual "Tilemaps"
(
https://docs.unity3d.com/Manual/tilemaps/work-with-tilemaps/tilemap-reference.html),ScriptReference/Tilemaps.Tilemap, and the 2D Tilemap Extras package manual (https://docs.unity3d.com/Packages/com.unity.2d.tilemap.extras@6.0/manual/index.html) for Rule Tiles. (@6.0is the version that ships with Unity 6.3 LTS; the old@1.6docs are for Unity 2021-era projects.)
Related skills
level-design— engine-agnostic blockout, pacing, and tile layout practice.procedural-gen— generating the tile data (noise, RNG, dungeons) you feed toSetTilesBlock.platformer/roguelike— genres that compose this skill with movement and generation.
Related skills
More from gamedev-skills/awesome-gamedev-agent-skills and the wider catalog.

unreal-behavior-trees
Build NPC AI in Unreal Engine 5 with Behavior Trees, Blackboards, and AIControllers.

unreal-blueprints
Build Unreal Engine 5 gameplay with Blueprint visual scripting—events, variables, and decoupled communication.

unreal-cpp-gameplay
Write Unreal Engine 5 C++ gameplay classes with reflection macros, Gameplay Framework, and module dependencies.

unreal-enhanced-input
Set up player input in Unreal Engine 5 with Enhanced Input system: Input Actions, Mapping Contexts, modifiers, and triggers.

unreal-niagara
Create and control real-time particle effects in Unreal Engine 5 with Niagara systems, emitters, and modules.

unreal-packaging
Package and ship UE5 projects with editor menus or command-line BuildCookRun automation.