
Two small Python scripts power every 2D asset in my game: one asks Gemini for art (a single icon, or an entire themed UI kit in one generation), the other slices any AI sprite sheet into individual transparent PNGs ready to drop into Unity. Both are free, exactly as I use them.
A single Gemini generation: a full Halloween UI kit — icons, buttons, currencies, progress bars, locks — already consistent because it came from one image.
python slice_sheet.py --sheet halloween_sheet.png --out cutoutsThe slicer samples the sheet's background color from the corners, keys it out, finds every sprite as a connected region, and saves each one as a cropped PNG with a real alpha channel. This sheet produced 35 individual sprites in about two seconds.
35 sprites sliced from a single generation — checkerboard shows real transparency, no touch-ups.
python gen_asset.py --type icon --name Trophy --prompt "a golden trophy cup" --ref Icons/Coin.pngSaving the PNG into the project still leaves the manual part. I close that gap with MCP for Unity, an open-source bridge that lets Claude Code operate the Unity Editor directly.
"Generate a Trophy icon style-matched to Coin.png and assign it to the
LeaderboardButton's icon Image in the MainMenu panel."Where this gets genuinely powerful is batch reskins. Slice the sheet, then tell the assistant: "swap every icon on the shop panel to its Halloween variant." It walks the panel's children, matches sprites by name, and re-themes the entire UI in one pass.
Command Builder
Try the scripts
Requires GEMINI_API_KEY. Saves directly to your project's Resources/Sprites folder.
pip install google-genai pillow rembg opencv-python numpy
setx GEMINI_API_KEY "your-key" # free at aistudio.google.com/apikey| Item | Cost |
|---|---|
| Both scripts | Free |
| Gemini image generation | ~$0.04 per image |
| The 35-sprite Halloween kit | ~$0.04 total |
| Slicing & cutouts | Free, runs locally |

Requires Python 3.10+. The actual files I use in production, shared as-is.