sprite-editor
Edits Unity sprite rectangles, borders, pivots, outlines, and slicing by generating C# scripts. Use when the user works with sprite sheets or sprite slicing.
How do I install this agent skill?
npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill sprite-editorIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The sprite-editor skill allows an AI agent to edit Unity sprite metadata by generating C# scripts and executing them via a local Unity Editor. It is an official utility from Unity Technologies. The skill is considered low risk, as its primary capability (custom script execution) is a documented feature for authorized developers. A minor security surface exists regarding indirect prompt injection from untrusted Unity asset metadata.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Sprite Editor
Sprite metadata (rects, borders, pivots, outlines) lives inside the importer, not in a file you can edit — reaching it means running C# through a live Editor.
The unity-cli skill owns getting you there — installing the CLI, confirming a connected
Editor, adding the project's com.unity.pipeline package, telling a genuinely absent Editor
apart from one stuck in Safe Mode, and discovering the Editor's command catalog. Follow it
first; don't re-derive any of it here.
Two things it can't know for you:
- You need
script evalin particular, not just a reachable Editor. Confirm it appears in the catalog — its presence depends on the Pipeline package version, not on the CLI. - Never hand-edit a
.metafile to change sprite metadata. The importer owns that data and the capability checks below exist to prevent corruption, so an unreachable Editor is a stop, not a cue to improvise.
Run C# through the connected Editor with the script eval command. Discover its parameter shape
from unity command --format json rather than assuming one — the inline form is
unity command script eval --caller plugin --skill sprite-editor --code '<snippet>', and some Pipeline versions also register
script eval_file for running a snippet from a file. Check the catalog before reaching for
script eval_file; it is frequently absent. unity command defaults to a 30 second timeout.
Generates C# editor scripts to manipulate Unity sprites using ISpriteEditorDataProvider. Works with TextureImporter, PSBImporter, and custom importers.
Passing C# to script eval
script eval compiles a statement block, not a file. Two consequences, both of which cause a
compile error rather than a warning:
- No
usingdirectives. The compiler readsusing UnityEngine;as a resource-disposal statement and rejects it (CS0210). - Types must be fully qualified. A bare
AssetDatabaseorVolumedoes not resolve (CS0246/CS0103), and a bareObjectis ambiguous withobject(CS0104).
Where a snippet below is written as a file — with usings, for readability, or because it is
meant to be saved into the project — qualify the types before passing it to script eval.
Workflow
All generated scripts must follow the Safe Core Pattern in references/templates.md, which includes MANDATORY capability checks. NEVER attempt operations if capability checks fail - this prevents data corruption. After execution, verify results in Unity console and Project window.
Common Operations
Modify Name/Rect/Border/Pivot: Update corresponding SpriteRect fields (see scripts/SetPivotExample.cs for pivot examples)
- Requires:
EditSpriteName,EditSpriteRect,EditBorder, orEditPivot
Add/Remove/Slice: Create or filter SpriteRect array (see references/background.md for Unity 2021.2+ requirements)
- Requires:
CreateAndDeleteSprite
Set Outlines: Get ISpriteOutlineDataProvider → Call SetOutlines() with GUID + Vector2 arrays
Important Notes
- Do NOT use AssetPostprocessor or MenuItem patterns
- Generate standalone snippets only — no
AssetPostprocessor, noMenuItem - Enum assignments: Always use enum values and cast to numeric types. Never use raw numbers.
- ✅ Correct:
(int)SpriteAlignment.Center - ❌ Wrong:
1(magic number)
- ✅ Correct:
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/unity-technologies/unity-agent-plugin/sprite-editor">View sprite-editor on skillZs</a>