AI for game programming: Unity, Godot and browser games

An agent writes scripts but does not see the engine editor. How to structure a game project for AI, what to hand the agent, what to do by hand, and what it costs.

6 min · · development · агенты

AI for game programming writes code well, but it does not see what a game developer spends half the time on: the editor window, the scene tree, the inspector, how an object behaves in motion. So in a game project the result depends not on how "smart" the model is but on how you split the work between the agent and yourself. Below is practice for Unity, Godot and browser games: project structure, rules for the agent, what to hand it, what to keep for yourself, and the cost of a session.

Engines are described in general terms and without tying to specific versions. Check editor setting names against the documentation of your version.

AI for game programming: how a game project differs from an ordinary one

In an ordinary application the agent changes files, runs tests and gets a text result. In a game part of the logic does not live in scripts:

  • Scenes and prefabs hold the links between objects, configured in the editor with the mouse.
  • Assets (models, sounds, textures) are binary and cannot be read as text.
  • The result is judged by eye: a game may compile and run but not jump the way you intended.

The consequence: scripts can be handed to the agent, but wiring objects in the editor, tuning physics and the "feel" of the game you have to sort out yourself.

Unity

C# scripts in Unity are convenient to hand to an agent: MonoBehaviour components, events, ScriptableObjects, editor helper utilities. What to keep in mind:

  1. Version and subsystems. State the Unity version and what you use: Unity has older and newer approaches (for example different input systems or render pipelines). Without that, the model may write code for another system.
  2. Compile errors appear in the Unity console, not to the agent. Copy the error text from the console into the chat or the message to the agent. It will not get it automatically.
  3. Scenes and prefabs. These are text files in YAML markup if the corresponding serialization is enabled (check the asset serialization mode in the editor section of the project settings). Do not have the agent edit them by hand: links between objects depend on identifiers, and one mistake breaks a scene. Let the agent write a script with public or inspector-marked fields, and you assign objects in the editor.
  4. .meta files. They store asset identifiers. They must be committed to version control together with assets, and the agent should not be allowed to delete and recreate them.

Working through Claude Code is described in the documentation; Cursor also suits editing C# scripts, see the Cursor guide. The key point: the agent works with the project folder on disk, while you open Unity in parallel and check the result yourself.

Godot

Godot is convenient for working with an agent because nearly everything lives in text files: .gd scripts in GDScript, .tscn scenes, .tres resources. The agent sees the structure and can suggest scene and script edits. What to keep in mind:

  1. Godot version. GDScript syntax differs between Godot 3 and Godot 4 (for example how exported and ready-initialized variables are declared). Always state the version at the start of the conversation and in the rules file.
  2. Edit scenes in the editor. The text format is readable, but hand edits easily break links between nodes. For small changes it is acceptable; for structural ones use the editor.
  3. Running without a window. Godot has a mode that runs without an interface for checking scripts and tests from the command line. See the documentation of your version for the exact flags and give the command to the agent so it can verify results on its own.

Browser games

For browser games in JavaScript or TypeScript (Canvas, WebGL, a game framework such as Phaser) conditions for an agent are the most convenient: the whole project is text, launching is simple, and the result is checked in the browser console. What helps:

  • keep game logic separate from rendering: an update(state, dt) function with no Canvas calls is easy to test in Node;
  • agree that the agent does not change the save format without your approval;
  • check the game yourself in the browser after each step and copy console errors to the agent.

Project structure and the rules file

The agent orients itself by a file in the project root (CLAUDE.md for Claude Code, AGENTS.md for others). A short example for a Unity project:

bash
## Project
Unity <your version>, C#, 2D platformer. Input: <the input system you use>.

## Structure
- Assets/Scripts/Player, Enemies, UI, Core
- Do NOT edit scenes and prefabs by hand.

## Rules
- Make new inspector fields with [SerializeField] private.
- Do not delete or create .meta files.
- Keep game logic in Core free of UnityEngine dependencies where possible.
- After an edit, list what I need to assign in the inspector.
- Do not add third-party packages without asking.

The inspector item is the most practical: the agent honestly lists what you must do by hand, and you do not lose half an hour looking for why "nothing happens". More on working with an agent in short iterations in the article what vibe coding is and what it costs.

Where AI helps and where it gets in the way

It helps with:

  • standard systems: state machines, inventory, dialogues, save and load, object pools;
  • mechanic prototypes: "make character control with a double jump" as a starting point;
  • interface scripts and editor utilities (tools for your pipeline);
  • porting code between engines and languages from a description;
  • explaining someone else's code and finding the cause of an error from a stack trace.

It gets in the way of:

  • physics and "feel" tuning: gravity, speed and inertia values are chosen by eye, and the model will not see the result;
  • inspector and scene wiring: that is done in the editor;
  • working "blind" with binary assets, animations and shaders: you can get code that compiles but looks wrong;
  • API versions: the model may suggest a function from another engine version, and you spend time hunting the error.

The general rule: ask the agent to write what can be verified by running a script or a test, and check by eye what has to be judged by eye, describing it to the model in words ("the object falls too slowly").

What it costs

A hypothetical session: 30 agent requests, 40,000 input tokens each (scripts, history) and 1,000 output. Input is 1.2M, output 0.03M. Zukko prices as of October 18, 2026, $ per 1M tokens, without cache.

ModelCalculationTotal
claude-sonnet-5-5 (0.4 / 2)1.2 × 0.4 + 0.03 × 2 = 0.48 + 0.06$0.54
gpt-6.1-sol (0.27 / 1.32)1.2 × 0.27 + 0.03 × 1.32 = 0.324 + 0.0396$0.36
glm-5.3-flash (0.04 / 0.04)1.2 × 0.04 + 0.03 × 0.04 = 0.048 + 0.0012$0.05
deepseek-v4.1-flash (0.013 / 0.038)1.2 × 0.013 + 0.03 × 0.038 = 0.0156 + 0.0011$0.017

For Claude the cache discount applies in the Anthropic format (Claude Code, /v1/messages); through /v1/chat/completions all input is billed at the input price. glm-5.3-flash has a 128K window: for large game projects with a long history it runs out sooner than 1M models. We do not compare quality in games: go by price, window and strength index (claude-sonnet-5-5 has 48, glm-5.3-flash has 42) and test on your own project. More on attaching Claude Code to an existing project: how to connect Claude Code to a project.

FAQ

Does Cursor or Claude Code suit Unity?

Both work with the project folder and can edit C# scripts. They do not replace the Unity editor: scenes, the inspector and running remain with you. Which is more convenient comes down to habit, so try both on a small task.

Can I do vibe coding in Unity?

For prototypes and small mechanics, yes, if you check the result in the engine and keep the project under version control. Without understanding scene structure the risk of getting tangled grows fast, so work in small steps and commits.

Which AI is best for games?

We do not claim that one model writes games better. Compare two or three models on one of your tasks by price and result.

How do I pay for the API from Russia?

Through the gateway: the agent connects to Zukko, and the balance is topped up from $1 via SBP, MasterCard or crypto. For a game project it is handy to set a daily limit on the key right away.

To try the approach, create a key in the dashboard and connect an agent to your project folder.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

AI for game programming: Unity, Godot, browser · Zukko