
sprite-segment-3x3grid
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.
- Installs
- 45
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill sprite-segment-3x3grid- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads sprite-segment-3x3grid automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Sprite Color Grid Analysis
Purpose
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.
Parameters
Match Threshold
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%
Algorithm
- Segment the Sprite: Divide the Sprite's texture region into a 3x3 grid (9 cells total)
- Identify Center Color: Calculate the majority (most frequent) color in the center cell (position [1,1])
- 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) - Generate Output: Create a text representation using the legend below
Output Legend
| 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) |
Output Format
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 Position Mapping
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
Examples
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 / . . .
Implementation Guidance
Calculating Center's Majority Color
For the center cell:
- Sample all pixels within the cell's bounds
- Group pixels by color (consider using a color tolerance threshold for similar colors)
- The majority color is the color with the highest pixel count
- For tie-breaking, use the first color encountered
Matching Non-Center Cells
For each of the 8 surrounding cells:
- Count the total number of pixels in the cell
- Count how many pixels match the center's majority color (using color tolerance)
- Calculate the match percentage:
matchingPixels / totalPixels - If match percentage >= threshold, cell is a match (
.); otherwise (X)
Color Tolerance
When comparing pixel colors:
- Consider using a tolerance threshold (e.g., RGB distance < 10) for "matching"
- Alternatively, for sprites with limited palettes, exact matching may be appropriate
- Account for alpha channel if relevant to the use case
Sprite Bounds
Use the Sprite's rect property to determine the pixel region to analyze:
sprite.rect.x,sprite.rect.yfor the originsprite.rect.width,sprite.rect.heightfor dimensions- Divide width and height by 3 to get cell dimensions
References
Code Template: "scripts/SpriteGridAnalysis.cs"
Use Cases
- Documentation: Describe sprite patterns in a compact text format
- Testing: Verify expected sprite structure in automated tests
- Analysis: Quickly identify sprites with similar color distributions
- Debugging: Understand why sprites look different than expected
- Asset Cataloging: Generate searchable metadata for sprite assets
Notes
- This analysis works best with sprites that have distinct color regions
- For sprites with gradients or many colors, consider increasing color tolerance
- The Y-axis is flipped from Unity's texture coordinates to produce top-to-bottom output
- Transparent pixels can be treated as a distinct "color" or ignored based on use case
FAQ
What does the sprite-segment-3x3grid skill do?
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.
How do I install sprite-segment-3x3grid?
Run npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill sprite-segment-3x3grid in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sprite-segment-3x3grid/ (personal) or .claude/skills/sprite-segment-3x3grid/ (project).
Which AI agents can use sprite-segment-3x3grid?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is sprite-segment-3x3grid safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains sprite-segment-3x3grid?
It is published by unity-technologies in unity-technologies/unity-agent-plugin. It has 45 recorded installs.
More from unity-technologies/unity-agent-plugin
unity-cli
unity-technologies/unity-agent-plugin
Controls the Unity Editor and projects from the command line, driving a running Editor to edit scenes and assets or run C. Use when asked to install or manage Editors, licenses, or projects, set up version control, build, test, configure the Unity MCP server, or run any unity command.
urp-postprocessing
unity-technologies/unity-agent-plugin
Sets up, configures, and debugs URP post-processing with the Volume framework. Use for bloom, tonemapping, color adjustments, depth of field, vignette, or other Volume overrides.
ui-ugui
unity-technologies/unity-agent-plugin
Understands, edits, and generates Unity uGUI Canvas hierarchies, RectTransforms, Layout Groups, and prefab UI. Use for requests involving Canvas, uGUI, RectTransform, or prefab UI files.
ui-uitk
unity-technologies/unity-agent-plugin
Understands, edits, and generates Unity UI Toolkit UXML and USS with flex layouts. Use for requests involving UI Toolkit, UIElements, UIDocument, PanelSettings, custom elements, or UI runtime binding.
unity-package-management
unity-technologies/unity-agent-plugin
Adds, removes, upgrades, and discovers Unity (UPM) packages from outside the Editor, with the Pipeline package commands first and a C script as the fallback. Use for package installs, verifying package IDs and versions, or choosing which packages a game needs.
new-unity-project
unity-technologies/unity-agent-plugin
Guides creating a new Unity project, gathering concept, platforms, and monetization before setting up the project, source control, and packages. Use when the user asks to start a new game or prototype.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.