tea-x-random/unity-game-skills/unity-image-generator

Claude Code and agent skill by tea-x-random/unity-game-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Generate and edit STATIC non-pixel 2D image assets for Unity casual games using Google's Gemini image API, then import them as sprites/textures/UI. Use for exploratory/concept art, style boards, non-pixel static sprites, backgrounds, tile/ground art, tiling textures, UI panels, buttons, icons, logos, title/menu art, particle textures, material/texture references, and high-quality image-to-3D references. For PIXEL ART final assets (low-res sprites, tilesets, directional sheets, animation strips), use unity-pixel-art/PixelLab instead; Gemini may only explore concepts. For non-pixel ANIMATED/motion assets prefer Tripo (unity-3d-generator) to rig + animate, then pre-render only for high-res/painterly 2D — never downscale 3D into pixel art. Covers Unity 2D import: Sprite mode, pixels-per-unit, filtering, sprite atlas, and ASTC for iOS.

Install

npx vskill@latest install tea-x-random/unity-game-skills/unity-image-generator

SKILL.md

The same SKILL.md was published earlier as tea-x-random/unity-game-skills/unity-image-generator.

Unity Image Generator

Generate static non-pixel 2D art with Gemini, then import it into Unity correctly for sprites, UI, or textures. This is the skill for static 2D concepts, non-pixel textures/grounds, backgrounds, UI/icons, and reference images. For pixel art final assets, route to unity-pixel-art (PixelLab) after Gemini exploration. Anything that moves in a non-pixel/high-res 2D style can be produced with Tripo (unity-3d-generator: rig + animate; pre-render to sprite frames), with Gemini providing the high-quality references that condition those Tripo models.

Gemini vs PixelLab vs Tripo — pick the right tool (library-wide rule)

Pixel art → PixelLab final. Non-pixel static/concept → Gemini. Non-pixel 3D/motion → Tripo.
  • Pixel-art final assets → `unity-pixel-art` (PixelLab): low-res sprites, tilesets, directional sheets, animation strips, icons, and any final asset that should read as deliberate pixel clusters. Gemini may explore references; it must not be the final pixel-art producer.
  • Gemini (this skill) → exploration and static non-pixel art: concepts, tiling ground/textures, backgrounds, UI, icons, logos, and high-quality reference images that condition Tripo or PixelLab.
  • Non-pixel motion / high-res 2D pre-render → Tripo (unity-3d-generator): rig + animate, then render to sprite frames for painterly/high-res 2D. This is not the pixel-art route.
  • Never create pixel art by Tripo/3D → downscale. Pixel art needs native canvas control, fixed palettes, crisp silhouettes, and anchor-first variants; use unity-pixel-art.
  • Gemini frame-by-frame animation DRIFTS (each independently generated frame loses identity) and is a fallback only for throwaway concepts or when both the pixel/3D final route is blocked.

API key & script

Key resolution: --api-key, then GEMINI_API_KEY. Probe first:

bash
bash $UNITY_GAME_SKILLS_HOME/unity-game-director/scripts/probe_asset_credentials.sh # GEMINI_API_KEY=SET|MISSING
bash
python3 $UNITY_GAME_SKILLS_HOME/unity-image-generator/scripts/generate_image.py \
--prompt "..." --filename Assets/<Game>/Art/Source/coin.png --resolution 2K \
--art-spec Assets/<Game>/Art/_ArtDirection/art-spec.yaml

Flags: --prompt/-p, --filename/-f (write under Assets/), --input-image/-i (REPEATABLE — edit/reference inputs), --input-role (repeatable; pairs with -i by position, e.g. "character identity", "art style" — sent to Gemini as interleaved text parts, there is no native role param), --resolution/-r {1K,2K,4K} (default: auto from the largest input image, else 1K; an EXPLICIT value always wins — hi-res reference sheets no longer inflate the output), --art-spec PATH / --no-art-spec, --character <id> (attaches that character's canon_sheet from the art-spec and injects its frozen identity_string verbatim), --no-spec-anchors, --api-key/-k.

Art-spec rule (production calls): the script resolves art-spec.yaml via --art-spec → $UNITY_ART_SPEC → the canonical/legacy roots (Assets/*/Art/_ArtDirection/art-spec.yaml, Assets/GameArt/..., Assets/Art/...), then injects the spec's verbatim style paragraph + light direction into the prompt and auto-attaches its conditioning.style_anchor_images. If no spec resolves, the call fails — exploratory/concept work must opt out explicitly with --no-art-spec. The same rule applies to validate_sprite.py and critique_image.py.

Production assets MUST be conditioned on canon references (discovery step)

A text-only prompt is an independent dice roll — the literal mechanism behind cross-asset drift. Before generating any production 2D asset, DISCOVER the project's canon:

  1. Resolve the art-spec (above); read its conditioning block (style_anchor_images, golden_assets) and characters block (canon_sheet, identity_string) — unity-asset-designer writes these.
  2. Check the approved registry (Assets/<Game>/Art/Approved/registry.yaml) for the asset's family golden.
  3. Probe Assets/<Game>/Art/_ArtDirection/sheets/ and Assets/**/Art/Refs/ for canon/turnaround sheets.

If canon artifacts exist they MUST be attached: --character <id> for a recurring character; -i <family_golden> --input-role "art style" for family members; spec anchors attach automatically. Generating production art for a project that has canon sheets WITHOUT attaching them is invalid. Concepts/style boards may skip (via --no-art-spec).

Alpha is preserved by default — never flatten foreground sprites onto white. generate_image.py writes real PNG alpha unless you ask otherwise:

  • --alpha-mode preserve (default) — keep the model's RGBA verbatim. Use for sprites the model already returned with transparency.
  • --alpha-mode chroma-key [--chroma-key-color magenta|cyan|r,g,b] [--chroma-key-threshold N] [--chroma-key-defringe N] — generate the subject on a solid matte, then key it to real alpha + autocrop + uniform pad. --chroma-key-defringe (default 1) erodes the anti-aliased edge ring to remove the matte-color halo; raise it if a fringe survives, set 0 to disable. This is the reliable transparency path (see "Transparency" below).
  • --alpha-mode opaque — flatten onto white. ONLY for assets that must be opaque: the iOS app icon, full-bleed backgrounds, seamless tiling textures.
A prior version of this script always composited RGBA onto white, producing white-matted sprites and pale edge halos after import. That is fixed; do not reintroduce it. For any gameplay-facing foreground object, leave alpha-mode at preserve or use chroma-key, then run the validator gate below.

Dependencies & quota gotchas (check these FIRST)

The script needs google-genai and pillow. On modern macOS the system Python is externally-managed (PEP 668), so install into a venv rather than pip install --user:

bash
python3 -m venv .artvenv && ./.artvenv/bin/pip install google-genai pillow
# run the script with .artvenv/bin/python ...

ModuleNotFoundError: No module named 'google' means this step was skipped.

Image gen needs billing on; once it is, the pipeline works. The script calls gemini-3-pro-image-preview (scripts/generate_image.py --prompt "..." --filename out.png --resolution 1K|2K|4K). One-time setup: python3 -m venv .artvenv && .artvenv/bin/pip install google-genai pillow. With billing enabled on the Google AI / Gemini API project, generation succeeds and PNGs import via the project's ArtImporter (Sprite + iOS ASTC). On a free-tier key it (and gemini-2.5-flash-image) returns 429 RESOURCE_EXHAUSTED ... limit: 0 — NOT transient rate-limiting; retrying and model-swapping both fail. If the probe shows a key but every image 429s with limit: 0, report it as a billing blocker (an allowed asset-sourcing skip) and fall back to procedural/placeholder art — do not loop on retries.

Exporting an interactive-only key to a non-interactive tool process. If GEMINI_API_KEY lives in ~/.zshrc (sourced only for interactive shells), a tool/agent shell won't have it. macOS has no timeout, and zsh -lc does NOT source ~/.zshrc — you must use -i:

bash
export GEMINI_API_KEY="$(zsh -ic 'printf %s "$GEMINI_API_KEY"' | tail -1)"

What to generate for casual games

  • Sprites / characters / props: request transparent background, single centered subject, consistent style, clean edges. If the requested finish is pixel art, stop here after concept exploration and route final generation to unity-pixel-art / PixelLab.
  • Sprite sheets: for non-pixel assets, request an evenly-spaced grid of frames on transparent background; slice in Unity (Sprite Editor / Grid By Cell). For pixel-art sheets, use unity-pixel-art anchor-first PixelLab generation instead of Gemini strips or 3D downscales. For non-pixel animated assets, Tripo rig + pre-render remains the default when identity/angles matter.
  • Backgrounds / parallax layers: request seamless or full-bleed layers sized to portrait phone aspect (e.g. 1080×1920 framing).
  • UI: buttons, panels, frames, progress bars, currency/HUD icons, settings glyphs — flat, high-contrast, readable at small size, transparent background. Keep a consistent icon family.
  • Logos / title art / app icon: bold silhouette, legible at thumbnail size, no tiny text. The iOS app icon must be square with no transparency.
  • Texture/material references and image-to-3D concepts: front/side/back T-pose sheets, tiling material swatches — these feed unity-3d-generator. When the concept will be rigged/animated via Tripo, generate a clean full-body T-pose (or A-pose) — arms away from the torso, legs apart, no props crossing the body — because auto-rigging fails on action poses; generate the action (e.g. a bow-draw) later as animation clips, not in the static concept (see ../unity-3d-generator/SKILL.md → "Riggable characters need a clean full-body T-pose").

Style is the user's, never the skill's (READ FIRST)

This skill is a neutral pipeline. Every style token — line weight, outline color, palette, shading model, fidelity, finish — comes from the user's stated aesthetic or a user-provided reference. The skill must never inject a house style: no default "cozy", "storybook", "cute", "AAA", "painterly", "thick ink", "high-detail". There is no such thing as a default look here, and flat/minimal is exactly as valid a target as high-detail rendered — neither is "better".

  • If the user gave an aesthetic, transmit it faithfully. Build the prompt from THEIR words, not your priors.
  • If the user gave a reference, MEASURE it (don't vibe it) — see "Match a reference" below.
  • If neither was given, ASK for one (a sentence of direction or one example image) before generating. A guessed style is the #1 cause of "looks nothing like what I wanted" churn — and the failure is silent, because self-graded art always "looks fine."
Real failure this codifies: a flat, muted, thin-line puzzle game (Pup Champs) was generated from injected adjectives ("cozy storybook thick-ink, warm palette"). Result: gorgeous but completely wrong — heavy black ink, saturated, painterly, dominant background, invisible grid. The skill, not the user, had supplied the style.

Prompt engineering (match the TARGET fidelity — high or flat)

One-line prompts produce one-line art. A production prompt names, in order: subject; view/framing (top-down, 3/4, side, centered); art style (from the brief/reference — name touchstones only if the user did); shape language (chunky, rounded, angular); palette with explicit tokens (hex or named, sampled from the reference); shading model as the target dictates — flat single-tone, cel, soft-gradient, or fully rendered with AO — these are CHOICES, not a ladder; fidelity/detail density as the target dictates (minimal-and-clean is a legitimate target, not a failure); output spec (transparent OR seamless tiling, single subject, no text/UI); and a negative prompt built from the axes where the target differs from the generator's default (next paragraph).

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3
7-day trend score
7

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/tea-x-random/unity-game-skills/unity-image-generator/badge)](https://verified-skill.com/skills/tea-x-random/unity-game-skills/unity-image-generator)

Something wrong with this skill or its page? Tell us.