2d-pixel-perfect
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP or Built-in. Use when a retro-style or…
Segments a Sprite texture into a 3x3 grid and outputs a pattern of cells matching the center cell's color. Use when the user asks to analyze or document a sprite's structure or color distribution.
$ npx -y skills add unity-technologies/skills --skill sprite-segment-3x3grid --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/sprite-segment-3x3gridContext preview
The summary Claude sees to decide when to auto-load this skill.
Segments a Sprite texture into a 3x3 grid and outputs a pattern of cells matching the center cell's color. Use when the user asks to analyze or document a sprite's structure or color distribution.
name: sprite-segment-3x3grid description: Segments a Sprite texture into a 3x3 grid and outputs a pattern of cells matching the center cell's color. Use when the user asks to analyze or document a sprite's structure or color distribution.
This skill analyzes Sprite textures by segmenting them into a 3x3 grid and outputting a text representation based on color matching with the center cell.
The **match threshold** determines what percentage of pixels in a non-center cell must match the center's majority color for that cell to be considered a "match" (`.`).
| Threshold | Description | Use Case | |-----------|-------------|----------| | **50%** | At least half the cell's pixels match center color | Lenient matching for sprites with mixed regions | | **75%** | At least three-quarters match center color | Moderate matching for mostly solid regions | | **90%** | Nearly all pixels must match center color | Strict matching for very uniform sprites |
**Default**: 75%
1. **Segment the Sprite**: Divide the Sprite's texture region into a 3x3 grid (9 cells total) 2. **Identify Center Color**: Calculate the majority (most frequent) color in the center cell (position [1,1]) 3. **Compare Each Cell**: For each of the 8 surrounding cells, calculate what percentage of pixels match the center's majority color. If the percentage meets or exceeds the **match threshold**, the cell is a match (`.`); otherwise it is not (`X`) 4. **Generate Output**: Create a text representation using the legend below
| Symbol | Meaning | |--------|---------| | `X` | Cell does NOT meet the match threshold (insufficient pixels match center color) | | `.` | Cell MEETS the match threshold (enough pixels match center color) | | `*` | The center cell itself (always position [1,1] in the grid) |
The output is a single line with three groups of three characters, separated by ` / `. Each group represents one row of the grid.
**Order**: Top to Bottom rows, Left to Right within each row.
**Format**: `[TopRow] / [MiddleRow] / [BottomRow]`
Each row contains 3 characters separated by spaces: `[Left] [Center] [Right]`
Grid Layout: Output Order: [0,0] [1,0] [2,0] 1 2 3 -> First group [0,1] [1,1] [2,1] 4 5 6 -> Second group (5 is always *) [0,2] [1,2] [2,2] 7 8 9 -> Third group
**Example 1**: Center matches top-left and bottom-right only
. X X / X * X / X X .
Grid interpretation:
. X X X * X X X .
**Example 2**: Center matches all surrounding cells
. . . / . * . / . . .
**Example 3**: Center matches none of the surrounding cells
X X X / X * X / X X X
**Example 4**: Center matches bottom row only
X X X / X * X / . . .
For the center cell: 1. Sample all pixels within the cell's bounds 2. Group pixels by color (consider using a color tolerance threshold for similar colors) 3. The majority color is the color with the highest pixel count 4. For tie-breaking, use the first color encountered
For each of the 8 surrounding cells: 1. Count the total number of pixels in the cell 2. Count how many pixels match the center's majority color (using color tolerance) 3. Calculate the match percentage: `matchingPixels / totalPixels` 4. If match percentage >= threshold, cell is a match (`.`); otherwise (`X`)
When comparing pixel colors:
Use the Sprite's `rect` property to determine the pixel region to analyze:
Code Template: "scripts/SpriteGridAnalysis.cs"
A collection of reusable AI agent skills for Unity workflows. Compatible with Claude Code, GitHub Copilot, Cursor, Cline, and 50+ other agents.
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP or Built-in. Use when a retro-style or…
Imports 3D models and point clouds with Asset Transformer Toolkit (formerly Pixyz), and creates, edits, and runs RuleSets,…
Routes Audio Sources into existing Audio Mixer Groups, classifying each source by what it plays. Use when the user asks about…
Builds node-based Editor tools with Unity Graph Toolkit (GTK) on Unity 6.6+: graphs, nodes, ports and validation, State Machine…
Builds and operates live games with Unity Services. Use when the user asks about backend or live-ops features such as player…
Creates and fixes Unity 2D physics in both systems, 2D Physics Core and the legacy Rigidbody 2D system. Use when the user asks…