Tilemap Ruletile Createfromsegment 标志

Tilemap Ruletile Createfromsegment

组织热门
Unity-Technologies
tilemap-ruletile-createfromsegment

根据现有地形或边缘精灵创建 RuleTile,使瓦片在绘制时自动拼接;还可将 sprite-segment-3x3grid 的输出模式转换为 TilingRules。用户希望精灵正确连接或定义瓦片邻接规则,并提供了精灵作为输入时使用。

Add to TypingMind

概览

发布者Unity-Technologies
代码仓库skills
技能名称tilemap-ruletile-createfromsegment
星标数
1K
复刻数
61
附带文件
3
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 3 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 Unity-Technologies 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Tilemap Ruletile Createfromsegment AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/Unity-Technologies/skills/tree/main/skills/tilemap-ruletile-createfromsegment
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Unity-Technologies/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/tilemap-ruletile-createfromsegment .claude/skills/tilemap-ruletile-createfromsegment
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Tilemap Ruletile Createfromsegment,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Tilemap Ruletile Createfromsegment。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Tilemap Ruletile Createfromsegment 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Tilemap RuleTile Create From Segment

Purpose

This skill creates Unity RuleTile TilingRules by first analyzing sprites using the sprite-segment-3x3grid skill, then converting the resulting text patterns into neighbor rule configurations. The user must specify Sprites or a Spritesheet input.

Workflow

Step 1: sprite-segment-3x3grid    Step 2: Create TilingRules
+--------------------------+      +--------------------------+
|  Analyze each Sprite     |      |  Parse text patterns     |
|  using color matching    |  ->  |  Map to neighbor rules   |
|  Output: text pattern    |      |  Sort by specificity     |
+--------------------------+      +--------------------------+

CRITICAL: Always run the sprite-segment-3x3grid skill first on each Sprite to generate the text pattern.

Step 1: Apply sprite-segment-3x3grid (Required)

For each Sprite in your texture, analyze it with sprite-segment-3x3grid:

csharp
string pattern = SpriteSegment3x3Grid.AnalyzeSpriteGrid(sprite, matchThreshold: 0.75f);

Pattern Output Format

Single-line text pattern: [TopRow] / [MiddleRow] / [BottomRow]

Each row contains 3 characters separated by spaces:

  • X - Cell does NOT meet match threshold
  • . - Cell MEETS match threshold (matches center color)
  • * - Center cell (the tile itself)

Example: X X X / X * X / . . .

Step 2: Create TilingRules from Patterns

Symbol to Rule Mapping

SymbolRuleTile NeighborValueBehavior
.This1Neighbor must be an instance of this RuleTile
XDontCare0Position not added to neighbors list
*(center)N/AIgnored - represents the tile itself

Note: "DontCare" is not an explicit constant. A position is "don't care" when it is simply not included in the m_Neighbors and m_NeighborPositions lists.

Neighbor Position Mapping

Grid Layout:              Unity Vector3Int positions:
[0] [1] [2]  (Top)        (-1,1,0)  (0,1,0)  (1,1,0)
[3] [*] [5]  (Middle)     (-1,0,0)    ---    (1,0,0)
[6] [7] [8]  (Bottom)     (-1,-1,0) (0,-1,0) (1,-1,0)
IndexPositionVector3Int
0Top-Left(-1, 1, 0)
1Top(0, 1, 0)
2Top-Right(1, 1, 0)
3Left(-1, 0, 0)
4Center(skipped)
5Right(1, 0, 0)
6Bottom-Left(-1, -1, 0)
7Bottom(0, -1, 0)
8Bottom-Right(1, -1, 0)

Pattern Filtering

By default, detected patterns that do not match any entry in the Common Tile Patterns table are discarded. Only the 47 known patterns are kept. This prevents unexpected or noisy rules from appearing in the final RuleTile.

If the user explicitly asks to keep non-standard patterns, set filterToKnownPatterns: false to bypass this filtering.

Deduplication

Duplicate TilingRules with identical neighbor configurations are automatically removed. When multiple sprites produce the same pattern, only the first sprite encountered is kept.

Rule Sorting

Rules are sorted by specificity (number of This rules) in descending order. More specific rules are evaluated first.

This CountExample PatternPriority
8. . . / . * . / . . .First
5. . . / . * . / X X X...
3X X X / X * X / . . ....
0X X X / X * X / X X XLast

Sprite Assignment

Each TilingRule is assigned at most 1 Sprite:

  • Set m_Output to TilingRuleOutput.OutputSprite.Single
  • Assign the sprite to m_Sprites[0]

The RuleTile's m_DefaultSprite is set to the sprite from the bottom-most (least specific) rule. Since rules are sorted by specificity descending, this is the last rule in the list. This sprite is used when no TilingRule matches.

Algorithm Summary

  1. For each Sprite: Run sprite-segment-3x3grid and store the pattern
  2. Filter: Discard patterns not in Common Tile Patterns (unless user opts out)
  3. Deduplicate: Remove duplicate patterns (first sprite wins)
  4. Parse: Split by / for rows, then by space for cells
  5. Extract Neighbors: . -> add position with This (1); X -> skip
  6. Create TilingRule: Populate m_Neighbors and m_NeighborPositions
  7. Assign Sprite: Set single sprite output
  8. Sort: Order by specificity descending
  9. Apply: Add sorted rules to RuleTile asset
  10. Default Sprite: Set m_DefaultSprite to the last (least specific) rule's sprite

Scripts

Implementation and usage examples are in the scripts/ folder:

FileDescription
TilemapRuleTileCreateFromSegment.csCore implementation with CreateRuleTileFromSprites, CreateTilingRuleFromPattern, ParsePattern, and ApplyRulesToTile
RuleTileGenerator.csEditor window example (Tools > Generate RuleTile from Sprites)
ManualWorkflowExample.csManual two-step workflow for finer control over analysis

Quick Usage

csharp
// Get sprites and create rules in one call
var rules = TilemapRuleTileCreateFromSegment.CreateRuleTileFromSprites(
    sprites, matchThreshold: 0.75f, colorTolerance: 0.04f);

// Apply to RuleTile
var ruleTile = ScriptableObject.CreateInstance<RuleTile>();
TilemapRuleTileCreateFromSegment.ApplyRulesToTile(ruleTile, rules);

Common Tile Patterns

Tile TypePatternThis Count
Fully surrounded (inner tile). . . / . * . / . . .8
Top left corner missingX . . / . * . / . . .7
Top right corner missing. . X / . * . / . . .7
Bottom left corner missing. . . / . * . / X . .7
Bottom right corner missing. . . / . * . / . . X7
Top corners missingX . X / . * . / . . .6
Bottom corners missing. . . / . * . / X . X6
Left corners missingX . . / . * . / X . .6
Right corners missing. . X / . * . / . . X6
Top Left and Bottom Right diagonal corners missingX . . / . * . / . . X6
Top Right and Bottom Left diagonal corners missing. . X / . * . / X . .6
Top Left, Top Right and Bottom Left corners missingX . X / . * . / X . .5
Top Left, Top Right and Bottom Right corners missingX . X / . * . / . . X5
Top Left, Bottom Left and Bottom Right corners missingX . . / . * . / X . X5
Top Right, Bottom Left and Bottom Right corners missing. . X / . * . / X . X5
Cross SectionX . X / . * . / X . X4
Flat edge (Bottom)X X X / . * . / . . .5
Flat edge (Top). . . / . * . / X X X5
Flat edge (Left). . X / . * X / . . X5
Flat edge (Right)X . . / X * . / X . .5
L-Shape, Point RightX X X / . * . / . . X4
L-Shape, Point Bottom. . X / . * X / X . X3
L-Shape, Point LeftX . . / . * . / X X X4
L-Shape, Point TopX . X / X * . / X . .3
L-Shape Inverse, Point LeftX X X / . * . / X . .4
L-Shape Inverse, Point BottomX . . / X * . / X . X3
L-Shape Inverse, Point Right. . X / . * . / X X X4
L-Shape Inverse, Point TopX . X / . * . / . . X5
T-Shape, face downX X X / . * . / X . X3
T-Shape, face topX . X / . * . / X X X3
T-Shape, face leftX . X / . * X / X . X3
T-Shape, face rightX . X / X * . / X . X3
Horizontal bridgeX X X / . * . / X X X2
Vertical bridgeX . X / X * X / X . X2
Corner piece, Bottom RightX X X / X * . / X . .3
Corner piece, Bottom LeftX X X / . * X / . . X3
Corner piece, Top Left. . X / . * X / X X X3
Corner piece, Top RightX . . / X * . / X X X3
Edge end, Bottom RightX X X / X * . / X . X2
Edge end, Bottom LeftX X X / . * X / X . X2
Edge end, Top LeftX . X / . * X / X X X2
Edge end, Top RightX . X / X * . / X X X2
Single isolated tile, LeftX X X / . * X / X X X1
Single isolated tile, RightX X X / X * . / X X X1
Single isolated tile, TopX . X / X * X / X X X1
Single isolated tile, BottomX X X / X * X / X . X1
CenterX X X / X * X / X X X0

Notes

  • Always run sprite-segment-3x3grid first -- this skill depends on its output
  • Rules are evaluated in order; first matching rule wins
  • A rule with 0 This conditions matches any configuration (use as fallback)
  • The center cell (*) is always ignored in neighbor calculations
  • Unity's RuleTile supports up to 8 neighbors in a standard 3x3 grid
  • For hexagonal or isometric grids, use HexagonalRuleTile or IsometricRuleTile

Prerequisites

  • sprite-segment-3x3grid skill: generates the input patterns. It ships in this same plugin as sprite-segment-3x3grid, so it is always available — invoke it rather than treating it as an unmet dependency.
  • com.unity.2d.tilemap.extras package: Required for RuleTile class

See Also

  • sprite-segment-3x3grid - required prerequisite; generates the input patterns
  • Packages/com.unity.2d.tilemap.extras/Runtime/Tiles/RuleTile/RuleTile.cs for RuleTile implementation
  • Unity Manual: Rule Tile

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Tilemap Ruletile Createfromsegment AI 技能有什么作用?

根据现有地形或边缘精灵创建 RuleTile,使瓦片在绘制时自动拼接;还可将 sprite-segment-3x3grid 的输出模式转换为 TilingRules。用户希望精灵正确连接或定义瓦片邻接规则,并提供了精灵作为输入时使用。

为什么在 TypingMind 中使用 Tilemap Ruletile Createfromsegment?

因为您只需安装一次,就能搭配任何模型使用。Tilemap Ruletile Createfromsegment 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Tilemap Ruletile Createfromsegment?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/Unity-Technologies/skills/tree/main/skills/tilemap-ruletile-createfromsegment。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Tilemap Ruletile Createfromsegment?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Tilemap Ruletile Createfromsegment 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Tilemap Ruletile Createfromsegment 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Tilemap Ruletile Createfromsegment AI 技能免费吗?

Unity-Technologies 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇