본문으로 건너뛰기
Skillpedia
일반 코딩6.6k · #13851

unity-tilemap-2d

하는 일

이 스킬은 Unity 6에서 2D 타일 맵을 만들고 스크립트로 다루는 방법을 설명합니다. 타일 이미지로 2D 레벨을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Unity의 Tile Palette로 2D 레벨을 그리고 싶을 때.
  • ✓타일에 충돌이 필요하거나 Rule Tile로 가장자리가 자동으로 이어져야 할 때.
  • ✓게임이 실행되는 동안 스크립트로 타일을 만들거나 편집해야 할 때.

스킬 링크

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/unity/unity-tilemap-2d/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/unity/unity-tilemap-2d/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Unity에서 2D 플랫폼 레벨을 그리고, 벽이 플레이어에게 막히도록 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

격자와 타일맵을 설정하고, 맵에 충돌을 추가하고, 자동 가장자리를 위해 Rule Tile을 사용하고, 코드로 타일을 바꾸는 방법을 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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, and so is the Tile Palette with its default brush. Rule Tiles, Animated Tiles, and the extra brushes (Random, Line, GameObject, Group) live in the separate "2D Tilemap Extras" package (com.unity.2d.tilemap.extras, 6.0.x for Unity 6.3) — install it via Package Manager before using RuleTile.

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 Grid with Tilemap children, or *.asset tile/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

  1. Create the grid: GameObject → 2D Object → Tilemap → Rectangular (the Grid's Cell Layout also offers Hexagonal and Isometric for hex/iso levels). This makes a Grid with a child Tilemap (+ TilemapRenderer). Use one Tilemap per layer (background, ground, foreground) and set each renderer's sorting.
  2. Open the Tile Palette (Window → 2D → Tile Palette), drag in a sliced sprite sheet to create Tile assets, then paint with the brush tools.
  3. Add collision to the solid layer: TilemapCollider2D. For one merged collider (far cheaper and gap-free), also add CompositeCollider2D (+ a Rigidbody2D set to Static) and set the tilemap collider's Composite Operation to Merge.
  4. Auto-tile with Rule Tiles (2D Tilemap Extras) so edges/corners pick the right sprite automatically instead of hand-placing every variant.
  5. Edit at runtime via script with cell coordinates (Vector3Int): SetTile, GetTile, SetTilesBlock, converting world↔cell with the Grid/Tilemap.
  6. Verify in Play mode: confirm collisions (Physics Debugger), sorting order, and that RefreshAllTiles ran 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

  • RuleTile type 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 CompositeCollider2D with a static Rigidbody2D and set Composite Operation to Merge to merge the whole layer into one smooth shape.
  • No "Used By Composite" checkbox, or an obsolete warning on usedByComposite — Unity 6 replaced it with Composite Operation (Collider2D.compositeOperation). Old usedByComposite = true maps to CompositeOperation.Merge; write that instead.
  • Small gaps remain between merged tiles — raise the Tilemap Collider 2D's Extrusion Factor so
자주 묻는 질문

Rule Tile을 쓰려면 추가 패키지가 필요한가요?

네. Rule Tile은 먼저 설치해야 하는 2D Tilemap Extras 패키지에서 제공됩니다.

이 스킬이 레벨 구조를 설계하나요?

아니요. 레벨 설계 원칙은 별도의 레벨 디자인 스킬에서 다룹니다.

3D 그리드도 다루나요?

아니요. 3D 타일 배치는 이 스킬의 범위 밖입니다.

상세 정보

작성자의 원본 설명

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.

repo: gamedev-skills/awesome-gamedev-agent-skills

인기도

GitHub 스타
6.6k
순위
#13851
라이선스
Apache-2.0
업데이트
2026. 10. 28.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬