AI Authoring
Convert your Unity offer UI with the AI assistant you already use
Your game already has an offer or store screen your players know. AI Authoring lets the coding assistant you already work with (Claude Code, Cursor, or any MCP-capable agent) read that UI and recreate it as a GameMantra custom page — measured from your prefabs, not guessed. Your Unity project is read locally; nothing is uploaded in this flow.
How it works
Export from the Unity Editor
GameMantra → Import my offer UI… → pick the prefab → Export for my AI assistant (local). The exporter collects only that page's dependency closure (prefabs, sprites, animations, fonts, related scripts), captures reference screenshots, and writes a ready-made PROMPT.md — all into a GameMantraExport/ folder next to your project. Nothing leaves your machine.
Paste the prompt into your assistant
The export dialog has a Copy prompt button. The prompt is self-locating — it tells your assistant exactly where the export lives and what to do with it.
The assistant converts, checks itself, and saves a draft
It measures your layout with our analysis tools, writes the template, runs it through the platform validator, builds a real preview, and compares the preview screenshots against your Unity reference captures. The result lands as a draft in your dashboard — previewed and ready to review.
You review and publish — always a human decision
Open the draft in your dashboard (see Custom Page for how drafts work): check the live preview, tap every button, read the assistant's report (including what it could not map). Publishing goes through the normal approval flow — the assistant can never push anything live.
Install
# Prerequisite: Python 3.10+. Stock macOS ships 3.9 and no pipx —
# install pipx first (it brings its own modern Python):
brew install pipx && pipx ensurepath # macOS; then restart your shell
# One-time install (pick one)
pipx install gamemantra # recommended
uv tool install gamemantra # if you use uv
pip install gamemantra # plain pip (needs Python 3.10+)
# Set up this Unity project for your AI assistant
cd /path/to/YourUnityProject
gm init # default: Claude Code (primary, most tested)
# Other assistants — same skill, same tools (MCP is an open standard):
gm init --agent cursor # Cursor
gm init --agent gemini # Gemini CLI (.gemini/settings.json + GEMINI.md)
gm init --agent codex # Codex CLI (AGENTS.md + prints the MCP TOML)
gm init --agent print # raw MCP config for anything elsegm init auto-discovers your game from Assets/GameMantra/Resources/gamemantra_config.json and writes your assistant's config from one shared source. It never reads the SDK api_key in that file. Note: if gm on your machine is GraphicsMagick, use the gamemantra alias — gm doctor detects the collision.
Any MCP-capable assistant works — Claude Code, Cursor, Gemini CLI, and Codex CLI all get the same skill and the same tools. Claude is the engine we test hardest against (our evaluation suite runs on it), so it's the default and what we recommend first; the others receive identical instructions but we haven't yet measured their conversion fidelity the same way.
The authoring key
# Sign in once: opens your browser, you approve a short code in the
# dashboard, and the key lands on this machine — you never see or paste it.
# (You can also sign in from the Unity Editor's export window.)
gm auth login
# Manual fallback: Dashboard → Settings → API Keys → Generate Key →
# "Authoring key", then paste it when gm auth login offers manual entry.
gm auth status # which studio/game this machine is bound to
gm doctor # checks project, key, and connectivityWhat leaves your machine
- Sent to GameMantra: the generated Dart template and bindings JSON — that's the product of the conversion. The reference-vs-preview visual compare happens on your machine, in the assistant's report. (An opt-in upload of the three reference screenshots, so the dashboard can show that compare too, is coming — the assistant will always ask first.)
- Sent with your consent (the assistant asks first): the images and fonts the page itself uses — they go into your own game's asset library, because the page can't render without hosted copies of its art.
- Never sent in this flow: your prefabs, scripts, scenes, or any project file beyond that page's art. The analysis runs locally on your machine.
- Preview screenshots are stored for 24 hours; agent run logs for 30 days. Re-running Preview regenerates anything that expired.
What the assistant calls (transparency)
# What your assistant does with the export (automated — shown for
# transparency). All calls use the authoring key against your base_url.
POST /v1/games/{game}/custom-pages/validate # static gates, <5 ms
POST /v1/games/{game}/custom-pages/draft # autosave (versioned)
POST /v1/games/{game}/custom-pages/preview # queue a real build
GET /v1/games/{game}/custom-pages/preview/{id} # status + screenshots
# It fixes validator blockers (max 3 tries), compares the preview
# screenshots against the reference captures from your export (max 3
# visual iterations), then reports honestly: what it mapped, what it
# assumed, and what it could NOT map.Prefer one click, no assistant?
The same Editor window has a Convert for me (cloud)button. It uploads just the selected page's UI slice — a consent dialog shows the file count, upload size, and script count before anything leaves your machine — and a hosted agent does the conversion. A teammate with the developer role (or above) confirms the run in the dashboard first; the finished draft appears under Offer Builder → Custom Page → Unity imports for your review. Nothing goes live without your approval, same as every draft.
AI processing disclosure: cloud conversions are processed with Anthropic's Claude API as a subprocessor, under Anthropic's no-training-on-API-data terms. The uploaded bundle is used only for your conversion; your gamemantra_config.json(your live SDK key) is never included in the bundle. Nothing you upload enters any shared evaluation set without your explicit consent.
Troubleshooting
- gm doctor first — it checks the project shape, config discovery, key validity, and connectivity in one pass.
- "authoring_key_expired" — run gm auth login (or re-export from the Editor) to renew.
- Export aborted: secret pattern found — one of the collected files contains a GameMantra API key. Remove the hardcoded key and re-export; keys never belong in scripts.
- The preview font looks generic — make sure the text in your prefab uses a TMP font asset; the exporter ships the font with the closure and the template binds it.
- Stuck? The assistant's final report lists everything it assumed or couldn't map — start there before re-running.