LLMs Struggle to Generate Executable Unity Game Code in Single Pass

Hugh Xuechen Liu, K{\i}van\c{c} Tatar· July 14, 2026 View original

Summary

This study evaluates large language models' ability to generate executable Unity C# code for game scenes in a single pass, without iterative repair. It reveals that even advanced models fail to produce compiling code, primarily due to a lack of engine-specific knowledge, categorizing common compiler errors.

Research investigated the capability of large language models (LLMs) to autonomously generate functional Unity C# code for game scenes. Unlike typical demonstrations that rely on iterative repair loops to fix errors, this study focused on a stringent single-pass generation, where the initial code draft was considered final. This approach aimed to isolate and assess the LLM's inherent parametric knowledge.The experiment involved 10,400 generations across four open-weight LLMs (7B-30B parameters) and various conditioning levels, targeting 26 distinct "Goal Playable Concepts." The findings were stark: none of the generated C# scripts compiled into a runnable scene. A detailed census of 90,673 compiler errors categorized them into "Grounding" (invented or misused Unity types/APIs) and "Hygiene" (structural C# defects).The distribution of these error types varied significantly by the game concept, with larger models and stricter intermediate representations shifting error patterns but never achieving a compiling scene. The primary bottleneck identified was the LLMs' deficiency in engine-specific knowledge, highlighting a critical limitation for single-pass code generation in complex environments like Unity.

Why it matters

Professionals in game development, AI-assisted content creation, and software engineering should understand that current LLMs, despite their code generation prowess, still lack the deep, specific domain knowledge required for complex, executable code in specialized environments without significant human oversight or iterative correction.

How to implement this in your domain

  1. 1Recognize the limitations of current LLMs for single-pass, domain-specific code generation in complex environments.
  2. 2Design AI-assisted development workflows that incorporate iterative human review and automated repair loops for generated code.
  3. 3Focus LLM code generation efforts on less complex, more generic programming tasks or specific code snippets rather than entire functional modules.
  4. 4Invest in fine-tuning LLMs with highly specific, well-structured datasets of domain-specific APIs and best practices.

Who benefits

Game DevelopmentSoftware EngineeringAI DevelopmentEdTech

Key takeaways

  • LLMs currently cannot generate executable Unity game scenes in a single pass.
  • The primary failure point is a lack of engine-specific knowledge, leading to "Grounding" errors.
  • Iterative repair loops are crucial for making LLM-generated code functional in complex domains.
  • Developers should manage expectations for LLM autonomy in specialized code generation.

Original post by Hugh Xuechen Liu, K{\i}van\c{c} Tatar

"arXiv:2607.10187v1 Announce Type: new Abstract: Large language models (LLMs) write Unity C\# for game scenes. Yet nearly all demonstrations rest on an iterative repair loop that regenerates code until it compiles, conflating what the model writes with what the loop fixes. We remo…"

View on X

Originally posted by Hugh Xuechen Liu, K{\i}van\c{c} Tatar on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses