The Deska blog
Running Agents on a Unity Project
Learn the technical stack for running agents on a Unity project to automate C# scripting, scene management, and asset workflows using LLMs and terminal tools.
10 min read
Developing complex games or interactive simulations requires managing thousands of lines of C# code, deep folder structures, and intricate scene hierarchies. The emergence of autonomous AI entities allows developers to streamline these tasks. Successfully running agents on a Unity project involves more than just asking a chatbot for snippets. It requires a robust environment where the agent has direct access to the file system, the ability to execute CLI commands, and a workspace that can handle multiple context windows simultaneously.
The Architecture of AI Agents in Game Development
To understand how agents interact with a Unity environment, we must distinguish between standard LLM chat interfaces and autonomous agents. A standard chat interface requires manual copying and pasting. An agent, however, functions as a loop that observes the file system, thinks about the next step, and acts by writing code or running tests.
In a Unity context, these agents typically interact with the .csproj files and the Assets folder. They use tools like grep to find references to specific game objects or dotnet commands to verify that new scripts compile correctly. Because Unity projects are often heavy and resource intensive, the environment where the agent runs must be stable and local first to ensure low latency and data security. You can read more about why this matters at /local-first.
Popular Agents for C# and Unity Workflows
Several tools have gained traction for their ability to handle large codebases. Each has a different approach to how they handle the project context.
- Claude Code: A research tool from Anthropic that runs in the terminal. It is highly effective at complex reasoning and can handle multi file edits within a Unity project.
- Codex CLI: Focuses on quick command line execution and simple script generations.
- OpenCode: An open source alternative that allows for deep customization of the agent logic.
- GitHub Copilot CLI: While not a fully autonomous agent, it provides a bridge for executing shell commands based on natural language.
These tools differ in approach when it comes to memory management. Some agents index the entire project, while others rely on the developer to provide specific file paths. When running agents on a Unity project, the ability to see the agent work side by side with your IDE is crucial for catching errors in real time.
Setting Up Your Workspace for Agentic Workflows
A fragmented workspace is the enemy of productivity when dealing with AI. If you have your agent in one terminal, your Unity Editor in another window, and your documentation in a browser tab, you lose the mental map of your project.
This is where a specialized environment like Deska becomes useful. It provides an infinite canvas where you can arrange these elements logically. You can place a terminal for Claude Code right next to a Monaco code editor and a browser window for the Unity API documentation. This spatial arrangement helps you monitor how the agent modifies your scripts without constantly switching windows. You can explore how these components work together at /canvas.
Monitoring Agents on the Go
Unity builds and long refactoring sessions take time. If you are running an agent to refactor a legacy codebase within Unity, you might not want to sit at your desk for the entire duration. Through a secure relay, the Deska mobile app allows you to monitor these agent sessions from your phone. Since the devices pair directly and no ports are exposed, you maintain the security of your local environment while gaining the freedom to move around. Details on this setup are available at /mobile.
Practical Use Cases for Agents in Unity
How do you actually apply these agents to your daily Unity work? Here are three common scenarios:
- Boilerplate Generation: Asking an agent to create a standard PlayerController script with specific input system requirements.
- Refactoring: Pointing an agent at a messy folder and asking it to implement a specific Design Pattern, such as a Singleton or Observer, across multiple scripts.
- Documentation: Running an agent to read through your
Scriptsfolder and generate aREADME.mdor inline Doxygen comments.
| Task Type | Recommended Agent Approach | Unity Impact |
|---|---|---|
| Scripting | Multi file editing agents | High |
| Asset Meta Management | CLI tools | Medium |
| Scene Hierarchy Analysis | Custom Python scripts via Agent | Low |
| Debugging Logs | Terminal monitoring agents | High |
Integrating Deska into Your Unity Stack
Deska is a free desktop app for Mac, Windows, and Linux that acts as a central hub for these operations. It does not replace your IDE but rather augments it by providing a place where coding agents can run in dedicated panels.
Within the Deska workspace, you can use Ask Deska, a voice and chat assistant. If you are deep in a Unity scene and need to run a specific agent command, you can use your voice to tell the workspace to open a new terminal or run a build script. This reduces the friction of context switching. You can learn more about voice commands at /docs/voice.
The platform is local first. Your Unity files and the sessions created by agents stay on your machine. For those who prefer to use their own API keys, Deska offers a lifetime tier, while managed inference is available for subscribers. The core workspace functionality remains free.
Managing Complex Agent Threads
When running agents on a Unity project, you often end up with multiple threads of thought. One thread might be focused on UI logic while another handles physics calculations. Keeping these organized is vital. Using a structured panel system allows you to isolate these tasks. You can find technical details on managing these sessions at /docs/agent-threads.
- Open a new workspace in Deska.
- Add a terminal panel and launch your preferred agent, such as Claude Code.
- Add a code editor panel to view the files the agent is modifying.
- Use a note panel to keep track of the prompts that yielded the best results.
FAQ: Common Questions About Unity AI Agents
Can I run AI agents directly inside the Unity Editor?
While there are plugins that integrate LLMs into the Unity Inspector, most powerful agents run as standalone CLI tools. These tools interact with the project files from the outside, which is often safer and more stable than trying to run an LLM inside the Unity engine thread.
How do agents handle Unity meta files?
Agents must be instructed to respect .meta files. If an agent moves a C# script without moving the corresponding meta file, the Unity project will break its internal references. Advanced agents like Claude Code can be taught to perform mv operations that include both files.
Is it safe to give an agent access to my entire Unity project?
Safety depends on the agent and the environment. Using a local first workspace ensures that your proprietary game code is not stored on external servers beyond the inference request. Always review the changes an agent proposes before hitting the save button in your IDE.
Getting Started with Local Agent Workflows
Transitioning to an agentic workflow requires the right set of tools and a mindset shift toward supervision rather than just execution. By centralizing your terminals, editors, and agents in a single spatial environment, you reduce the cognitive load of game development.
To start building your custom Unity agent workspace, you can download the Deska app for your operating system and begin placing your first panels today.