How to prototype a Unity scene from a text description
Когда использовать: You want to go from 'low-poly forest with a player and 5 patrolling enemies' to a runnable scene without wiring every GameObject by hand.
Предварительные требования
- Unity 2021.3 LTS or newer, Python 3.10+, uv — Install uv via
brew install uv; Unity from unity.com/download - Install the Unity package — Window > Package Manager > + > Add from git URL: https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main
Поток
-
Describe the scene you wantCreate a new scene called 'ForestDemo'. Add a low-poly terrain 200x200, a player capsule at origin with a rigidbody, and 5 cube enemies placed randomly between (-50,-50) and (50,50).✓ Скопировано→ Scene created, GameObjects appear in Hierarchy, Unity reflects changes live
-
Ask for behavior scriptsCreate a C# script EnemyPatrol.cs that moves between two random waypoints, and attach it to every Enemy* GameObject.✓ Скопировано→ New script compiles cleanly, attached to enemies
-
Enter Play mode and iterateEnter Play mode for 5 seconds, then read the console and tell me if anything threw.✓ Скопировано→ Runtime log returned, Claude proposes concrete fixes for any NullReferenceException
Итог: A runnable prototype scene with scripted enemies — under 15 minutes of chat.
Подводные камни
- Script edits reject because of compile errors cascading — Ask Claude to run manage_script validate before apply_text_edits
- Domain reload wipes runtime state mid-session — Save scene explicitly before script edits; use refresh_unity afterwards