5 tips for using GitHub Copilot with Unity

STACEY HAFFNER / UNITY TECHNOLOGIESContributor
Aug 11, 2026|5 MIN
A dark-themed inline code editor prompt panel, showing a C# file reference tag labeled "EquipmentSlot.cs:9-18" at the top, a text input field with placeholder text "Describe what to build," and a bottom toolbar with buttons for add (+), Agent mode, Auto mode, a settings/filter icon, and a stop button.

With Unity’s AI tools now available in beta, we’re seeing a lot of excitement around its new features, namely the in-Editor AI assistant and its integrations with popular developer tools. If you’re new to the beta, you can learn more on the AI tools web page. We’ve also created a video tutorial series to help you get started with its core features.

We sat down with Stacey Haffner to discuss how she uses GitHub Copilot with Unity to optimize her game development workflows. Stacey is a former principal developer advocate at Microsoft, as well as a YouTuber with more than a decade of experience as an independent game developer. Her background spans creator technology across .NET, Xbox, and Unity. When she isn't advocating for developers, she manages her own indie studio and publishes bi-weekly game development tutorials.

Let’s dive in.

Tip 1: Work with the context window, not against it

“The context window is the AI's working memory for a session which has a limit. Depending on which underlying model is being used, performance can start to degrade before it even reaches its limit, so responses can become less accurate as a session goes on. GitHub Copilot helps with this by letting you compact a session, but if you trigger compaction after the underlying model has already started to degrade, the degraded state becomes your new baseline. That's why I recommend structuring your workflow around this limit from the start.”

“For more complex features, I use the main chat thread to orchestrate that work. For a big feature, I’ll have the main thread break the work into focused chunks, then start up background agents to handle each one. A coding agent handles the implementation, a validation agent reviews it, and once the review passes, the cycle repeats until the feature is done. Each agent works in its own context, so the main thread stays focused and performs consistently for longer.”

A Visual Studio Code window showing a GitHub Copilot chat panel titled "MODULAR QUEST SYSTEM IMPLEMENTATION PLAN." A user prompt asks Copilot to create an implementation plan for a modular quest system for an open-world RPG in Unity, with branching dialogue, quest dependencies, NPC interactions, rewards, and editor tooling, referencing the file EquipmentSlot.cs lines 9–18. Copilot's response explains it is launching two parallel research agents — one exploring Unity quest system options by reading README.md, and one scanning the project architecture by reading Interactable.cs lines 1–40 — with a "Thinking" status indicator at the bottom.

Tip 2: Set up the project environment

“The underlying models powering GitHub Copilot are typically generalist, but you can customize Copilot’s behavior by adding configuration files to the .github folder in your project. You can add three main file types to help GitHub Copilot understand your project and your domain.”

  • Custom Instructions are always-on context that Copilot loads for every session that defines your project’s baseline. They should include your preferred coding conventions, Unity project specifications (for example, Unity Engine version and rendering pipeline), architecture patterns, and general preferences. Use these for things that should always be true regardless of which part of the project you're working on.
  • Agents are domain expert personas, each with their own dedicated tools and instructions. I have agents focused on shaders, UI Toolkit, game systems, and so on. At its simplest, you pick the agent that matches the work at hand, but you can add more structure by including handoffs between agents.
  • Skills are modular, reusable instructions that load only when a specific task triggers them. The skill description loads in every session so the model knows when to call it, but the full details only load when they're actually needed. For example, my UI Toolkit agent calls individual skills for styling, UXML writing, and related tasks depending on what's needed. This keeps the model's memory context efficient between tasks.
A Visual Studio Code "Agent Customizations for Local" settings panel with a dark theme. The left sidebar lists navigation items — Overview, Agents (9), Skills (32), Instructions, Prompts (4), Hooks (2), MCP Servers (2), and Plugins (1). The main content area displays a heading "Agent Customizations for Local" with the description "Tailor how agents work in your projects. Configure workspace customizations for the entire team, or create personal ones that follow you across projects." Below is a text input labeled "Customize Your Agent" with placeholder text "Prefer concise commits, thorough reviews, and tested code…" Six feature cards follow in a grid — Agents, Skills, Instructions, Hooks, MCP Servers, and Plugins — each with a short description and a "New…" or "Browse…" button.

Tip 3: A great plan goes a long way

“Plan mode is the first step before any implementation starts. When you use the /plan command followed by your specific instructions, GitHub Copilot reasons through your codebase and requests to map out an implementation path before it writes a single line of code.

Be sure to describe the feature or fix in as much relevant detail as possible, then ask Copilot to investigate and return with questions. The exchange will help you think through the user experience and functionality in more detail, which often surfaces edge cases. Once that iteration is done, have the AI define the broad strokes of the implementation including what existing systems it uses, what new classes and methods you need to create, and how it all fits together. Only then should you let it write the code.”

A dark-themed Visual Studio Code chat input box showing a typed prompt beginning with the slash command "/plan" (highlighted in blue) followed by: "Create an implementation plan for a modular quest system. The system should support branching dialogue, quest dependencies, scripted events, objectives, NPC interactions, rewards and editor tooling. Organize the work into milestones, identify technical risks, and recommend the architecture. Ask questions to think through the design / edge cases." The toolbar below shows Agent mode, Claude Opus 4.8, High 1M context, and a settings icon. The status bar at the bottom displays Local, Default Approvals, Projects: 2, Debug Any CPU, and Solution: starter-project.slnx.

Tip 4: Don’t skip the code review

“AI-generated code needs review, especially if it’s code that stays in the project long term. Once the implementation returns, you should treat it like a pull request and read through it.”

“I tried several different approaches to this before VS Code shipped the agent window, and I now use that the most. I can highlight specific code and use the /Explain command to have the AI walk me through what it does, or the /Review command to have it critique the code it just wrote. From there, I’ll add inline comments directly in the diff, as I would on a real pull request, and send them back as a group to the AI for iteration.”

“This habit matters because it keeps the code up to my standards and ensures I maintain a deep understanding of my systems. That knowledge helps me make the right design decisions as the game grows.”

A Visual Studio Code panel titled "Active Selection Explanation in C#" showing the /explain slash command used on a selected code snippet from EquipmentSlot.cs lines 9–18. The highlighted code shows a private void OnRightClick(PointerDownEvent evt) method that guards against non-right-clicks and null items, stops event propagation, drops the item via DropItem(), and returns it to inventory via InventoryWindow.Instance.TryReturnItem(item). Below the code block, Copilot's explanation describes the method in four paragraphs: its purpose as a right-click unequip handler, the two early-return guard clauses, why StopPropagation() prevents duplicate UI events, and how DropItem() and TryReturnItem() together remove the item from the slot and return it to the player's inventory.

Tip 5: Use AI as a personal tutor

“You can use GitHub Copilot to create a custom tutorial for any Unity concept you want to learn. Because GitHub Copilot can read your project, you can ask it to tailor the lesson to what your game needs and your skill level.”

"I’d wanted to learn shaders for a long time, so I built a Unity Shader Graph agent that leans hard into teaching and used it to make ground-targeting overlays for combat. When I encountered a concept I didn't fully understand, I could ask questions and only moved to the next step when I was ready."

"It’s important to use a series of lessons that build independence over time. For example, I asked it to provide guided tutorials for the first two shaders. It walked me through the unfamiliar nodes and the math so I actually understood how each shader worked. I wanted to build the third shader on my own, so when I got stuck I just asked for a hint instead of the answer. It gave me a couple of guiding questions that helped me identify the next step, and I kept going. By the end of the process, I actually understood what I’d created.”

A dark-themed shader graph editor (likely Unity Shader Graph or a similar node-based tool) showing a complex network of interconnected nodes connected by teal/cyan wires. The graph is organized into labeled sections including "Outer Circle," "Cone," and "Line." Nodes display various intermediate texture previews — including white, black, and gray circles, gradient ramps, a cone/teardrop shape in multiple stages, black-and-white stripe patterns, and color gradient swatches in green-to-red and black-to-red. Yellow annotation nodes provide descriptive comments throughout the graph. The bottom-right shows a "Main Preview" panel rendering the final output: a solid red circle on a dark background. The left panel shows shader property inputs including Enum Keyword, Float, Boolean, and multiple Float parameters.

In-depth look with Stacey and AI beta access

For a deeper dive, Stacey has shared several videos covering these topics on her YouTube channel. Access to Unity’s in-Editor AI assistant is available now in open beta. Start your free 14 day trial here.