Views
No views yet
.unity scene files, project
configuration (manifest, ProjectSettings, .meta) and a full open-world
city example game. The output is a real Unity project you can open in
Unity Hub and press Play.Assets/, Packages/manifest.json,
ProjectSettings/, .meta files) exactly the way Unity expects.1git clone <this-repo> unity-agent
2cd unity-agent
3pip install -e . # optional; the package also works with PYTHONPATH=.1# Generate the full open-world city example into examples/open_world_city/
2python -m unity_agent generate --game open_world_city --preset open_world_city --output-dir examples
3
4# Run static QA on it
5python -m unity_agent qa examples/open_world_cityexamples/open_world_city/ in Unity Hub (2022.3 LTS or newer) and
press Play.1from unity_agent.config import Settings
2from unity_agent.transport.unity_transport import UnityTransport
3from unity_agent.tools.unity_tools import (
4 SetupUnityProjectTool,
5 CreatePlayerControllerTool,
6 CreateProceduralCityTool,
7 WriteSceneFileTool,
8)
9
10settings = Settings(output_dir="my_games")
11transport = UnityTransport(settings)
12
13SetupUnityProjectTool(settings, transport).run(project_name="MyGame")
14CreatePlayerControllerTool(settings, transport).run(project_name="MyGame")
15CreateProceduralCityTool(settings, transport).run(project_name="MyGame")
16WriteSceneFileTool(settings, transport).run(project_name="MyGame", scene_name="MainScene")
17
18print(transport.summary())1python -m unity_agent --help
2
3# Commands
4python -m unity_agent list-tools
5python -m unity_agent setup --project-name MyGame --output-dir my_games
6python -m unity_agent generate --game MyGame --preset open_world_city
7python -m unity_agent generate --game MyFPS --preset fps_arena
8python -m unity_agent generate --game Minimal --preset minimal
9python -m unity_agent qa path/to/MyGameunity-agent/
unity_agent/
__init__.py # Package entry point
__main__.py # CLI: `python -m unity_agent ...`
config.py # Settings (Unity path, LLM keys, output dirs)
tests.py # Self-test suite (run with `python -m unity_agent.tests`)
transport/
__init__.py
unity_transport.py # Writes .cs / .unity / .meta / config files
tools/
__init__.py
base.py # ToolBase + ToolRegistry + @register_tool
unity_tools.py # 24 tools (see below)
orchestrator/
__init__.py
prompts.py # SYSTEM_PROMPT + build_user_prompt + tool_catalog
knowledge/
README.md
__init__.py # load_entry / list_entries / load_all
entries/
unity_fundamentals.md
unity_physics.md
unity_rendering.md
unity_navigation.md
unity_input_system.md
unity_ui.md
unity_audio.md
open_world_design.md
qa/
__init__.py # ProjectQA + Issue + QAReport + CLI
examples/
generate_example.py # Regenerates examples/open_world_city/
open_world_city/ # A complete generated Unity project
Assets/Scripts/*.cs
Assets/Scenes/MainScene.unity
Packages/manifest.json
ProjectSettings/*
README.md
pyproject.toml
README.md| Tool | Output |
|---|---|
setup_unity_project | Project scaffold (manifest, ProjectSettings, asmdef) |
create_player_controller | PlayerController.cs (WASD + jump + physics) |
create_vehicle_controller | VehicleController.cs (arcade car physics) |
create_procedural_city | CityGenerator.cs + BuildingGenerator.cs (50+ buildings) |
create_third_person_camera | ThirdPersonCamera.cs (smooth follow + collision) |
create_fps_controller | FPSController.cs (mouse-look + WASD + jump) |
create_day_night_cycle | DayNightCycle.cs (sun rotation + sky/ambient lerp) |
create_ai_npc | NPCController.cs (NavMesh wander/chase FSM) |
create_pickup_system | PickupSystem.cs + Pickup.cs (score + collectibles) |
create_health_system | HealthSystem.cs + HealthBar.cs |
create_weapon_system | WeaponSystem.cs (raycast hitscan + ammo + reload) |
create_audio_manager | AudioManager.cs (SFX + music singleton) |
create_ui_manager | UIManager.cs (TMP HUD: score / health / messages) |
create_terrain_generator | TerrainGenerator.cs (Perlin heightmap + splat) |
create_water_shader | WaterMaterial.cs (animated standard-material water) |
create_particle_effects | ParticleSpawner.cs (bursts + explosion helper) |
create_save_system | SaveSystem.cs (JSON save/load to persistentDataPath) |
create_inventory_system | InventorySystem.cs (stacks + capacity + events) |
create_quest_system | QuestSystem.cs (state machine + progress + completion) |
create_building_generator | BuildingGenerator.cs (walls + emissive windows + collider) |
create_road_network | RoadNetwork.cs (grid layout + intersections) |
write_csharp_script | Any C# script to Assets/Scripts/ |
write_scene_file | .unity scene file to Assets/Scenes/ |
generate_complete_game | Full game in one call (presets: open_world_city, fps_arena, minimal) |
unity_agent.orchestrator.prompts.SYSTEM_PROMPT is a long, prescriptive
prompt that teaches the LLM to:Start() generation) over
inspector-wired prefabs so the example "just plays" on open.UnityAgent namespace and the UnityAgent.Scripts asmdef.1from unity_agent.orchestrator import SYSTEM_PROMPT, build_user_prompt
2
3prompt = build_user_prompt("Build me an open-world city game I can drive around in")
4# Send SYSTEM_PROMPT + prompt to your LLM, then dispatch tool calls.unity_agent/knowledge/entries/:unity_fundamentals.md -- MonoBehaviour lifecycle, GameObjects,
components, coroutines, inspector best practices.unity_physics.md -- Rigidbody, colliders, raycasting, ForceModes,
physics vs frame step.unity_rendering.md -- Materials, Standard shader, lighting, post-
processing, LOD, fog.unity_navigation.md -- NavMesh, NavMeshAgent, AI state machines,
NavMeshObstacle, off-mesh links.unity_input_system.md -- Legacy Input Manager, mouse-look recipes,
new Input System, touch.unity_ui.md -- Canvas, anchoring, HUD pattern, TMP, performance.unity_audio.md -- AudioSource, 3D audio, AudioMixer, AudioManager
singleton.open_world_design.md -- Procedural generation, LOD, streaming,
day/night cycle, save systems.1from unity_agent.knowledge import list_entries, load_entry, load_all
2
3for slug in list_entries():
4 print(slug, len(load_entry(slug)))unity_agent.qa.ProjectQA runs static checks against a generated project:Assets/, Assets/Scripts/, Packages/,
ProjectSettings/).Packages/manifest.json,
ProjectSettings/ProjectVersion.txt,
ProjectSettings/ProjectSettings.asset)..cs file has balanced braces and at least one type declaration..cs and .unity file has a sibling .meta.%YAML header.manifest.json parses as JSON and has a dependencies object.1from unity_agent.qa import ProjectQA
2report = ProjectQA("examples/open_world_city").run()
3print(report.summary())
4print("PASS" if report.passed else "FAIL")python -m unity_agent.tests