unity-tilemap-2d
БесплатноБез исполняемых скриптовНе проверенUnity 6.3 LTS 2D tilemaps: the Tile Palette, Tilemap Collider 2D with a Composite Collider, Rule Tiles and runtime SetTile. Use for painting or generating a…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Unity 2D Tilemap
Author and script tile-based 2D levels in Unity 6.3 LTS (6000.3) with Grid and Tilemap,
merged colliders and runtime painting, and check the result by reading the map back.
Package note:
Grid,Tilemap,TileandTilemapCollider2Dare built in. The Tile Palette window and default brush come from the 2D Tilemap Editor package (com.unity.2d.tilemap, included in the 2D templates). Rule Tiles, Animated Tiles and the extra brushes (Random, Line, GameObject, Group) are in 2D Tilemap Extras (com.unity.2d.tilemap.extras, the 6.0.x line for Unity 6.3).
When to use
- Laying out a 2D level with tiles, a
GridwithTilemapchildren, collision for the map, auto-tiling with Rule Tiles, generating or editing tiles from script. - Scenes contain a
GridwithTilemapchildren, or there are tile and palette.assetfiles.
When not to use: layout and pacing → level-design; noise, rooms and dungeon
generation that produce the tile data → procedural-gen; the character that walks on the
tiles → unity-physics; 3D grids have no skill here. If Unity's official
create-tile-palette-or-rule-tiles skill is installed and an Editor is connected, use it to
build palettes and Rule Tile assets; this skill owns runtime code and colliders.
Workflow
- Gate on packages. Before writing
RuleTileorAnimatedTilecode, confirmcom.unity.2d.tilemap.extrasis inPackages/packages-lock.json; ask before adding it. - Set up the grid. One
Gridwith oneTilemap(plusTilemapRenderer) per layer: background, ground, foreground. TheGrid's Cell Layout is Rectangle, Hexagon, Isometric or Isometric Z As Y. Give eachTilemapRendereran explicit Sorting Layer and Order. - Make tiles. Designers drag a sliced sprite sheet into the Tile Palette. From code, an
editor script can create
Tileassets from the sheet's sprites (pattern 3). - Add collision to the solid layer.
TilemapCollider2D, plus aCompositeCollider2D(which adds aRigidbody2D: set it toStatic), and set the tilemap collider's Composite Operation to Merge. One merged shape is cheaper and has no seams. - Edit at runtime in cell coordinates (
Vector3Int):WorldToCell,SetTile,GetTile,SetTilesBlock, thenRefreshTilefor the edited cells only. - Verify with the checks below.
Patterns
1. Paint and query at runtime
using UnityEngine;
using UnityEngine.Tilemaps;
public class TilePainter : MonoBehaviour
{
[SerializeField] private Tilemap tilemap;
[SerializeField] private TileBase groundTile;
public void PaintAt(Vector3 worldPos) => tilemap.SetTile(tilemap.WorldToCell(worldPos), groundTile);
public bool IsSolid(Vector3 worldPos) => tilemap.HasTile(tilemap.WorldToCell(worldPos));
}
2. Fill a region in one call
// SetTilesBlock writes a whole BoundsInt at once: use it for generated rooms and floors.
public static 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);
}
SetTile(cell, null) erases a cell. RefreshTile(cell) re-evaluates that cell and its rule
neighbours; RefreshAllTiles() re-evaluates the whole map, so keep it for full regenerations.
3. Create Tile assets from a sliced sheet (editor code)
Put this in an Editor folder; run it from the menu, through
unity command script eval --code 'TileAssets.FromSheet("Assets/Art/terrain.png", "Assets/Tiles");',
or with -executeMethod from a wrapper with no parameters.
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Tilemaps;
public static class TileAssets
{
public static void FromSheet(string sheetPath, string outFolder)
{
if (!AssetDatabase.IsValidFolder(outFolder)) // e.g. "Assets/Tiles"; the parent must exist
{
int slash = outFolder.LastIndexOf('/');
AssetDatabase.CreateFolder(outFolder.Substring(0, slash), outFolder.Substring(slash + 1));
}
foreach (Sprite sprite in AssetDatabase.LoadAllAssetsAtPath(sheetPath).OfType<Sprite>())
{
var tile = ScriptableObject.CreateInstance<Tile>();
tile.sprite = sprite;
AssetDatabase.CreateAsset(tile, $"{outFolder}/{sprite.name}.asset");
}
AssetDatabase.SaveAssets();
}
}
The sheet must already be imported as Sprite (Multiple) and sliced; the slices are the sprite sub-assets.
Verify
- No Editor needed: the scene YAML holds the map. A
Tilemap:document lists painted cells underm_Tiles:(- first: {x: 0, y: 8, z: 0}), and aTilemapCollider2Dset to merge hasm_CompositeOperation: 1. Grep these to confirm the layer has tiles and the collider merges. - **Unity CLI with a
Установить unity-tilemap-2d в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл unity-tilemap-2d?
Unity 6.3 LTS 2D tilemaps: the Tile Palette, Tilemap Collider 2D with a Composite Collider, Rule Tiles and runtime SetTile. Use for painting or generating a tile level, seams between tile colliders, RuleTile not found, or hex and isometric grids. Not for level design (`level-design`), generation (`procedural-gen`), movement (`unity-physics`) or Godot (`godot-tilemap`).
Как установить скилл unity-tilemap-2d?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity-tilemap-2d запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic