Terminal
Terminal/Skill
Splits a sprite into a 3x3 grid and outputs a text pattern of which outer cells match the center color, to document sprite structure.
By Unity
Works with
npx skills add unity-technologies/skills --skill sprite-segment-3x3gridThis 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%
.); otherwise it is not (X)| 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:
For each of the 8 surrounding cells:
matchingPixels / totalPixels.); otherwise (X)When comparing pixel colors:
Use the Sprite's rect property to determine the pixel region to analyze:
sprite.rect.x, sprite.rect.y for the originsprite.rect.width, sprite.rect.height for dimensionsCode Template: "scripts/SpriteGridAnalysis.cs"