I spent several nights trying to get Claude Code (CC) working with Unity projects on Windows. Here's a record of the various issues encountered and their solutions.
TL;DR upfront: At this stage, I don't recommend attempting this workflow - CC doesn't natively support Windows, it's one pitfall after another, and the cost of solving various engineering configuration issues is quite high. Even after getting it working, the actual experience isn't as amazing as expected.
The basic installation steps are: install WSL first, then install CC in WSL (https://docs.anthropic.com/en/docs/claude-code/setup), then open your IDE on Windows with remote connection to WSL and open the Unity project from there. I won't go into too much detail about the regular setup and usage steps - check the documentation yourself and ask AI when you encounter problems.
Important Note: The only IDE that was found to work relatively stably is VSCode.
- Need to first use
findin WSL to locate the claude-code.vsix file, then install it in PowerShell - Remote WSL to open the Windows project directory
- When using remote WSL, the IDE only recognizes WSL-format paths, so you need to replace paths in the mcp.json prepared for Claude to start with
/mnt/c/ - Python scripts can't share the same venv between WSL and Windows - need to copy a separate version for each
- EXE programs should be directly callable
- Microsoft officially restricts C# series plugins from being provided in non-official VSCode versions. Although Cursor provides its own C# plugin, the VSCode Unity plugin still depends on the official version
- You can try Cursor C# + dotRush plugin, but I haven't tested it because I switched to Rider
- Install .NET 9.0 SDK in WSL according to Microsoft's official website, then manually specify .NET CLI as
/usr/lib/dotnet/in Settings → Build, Execution, Deployment → Toolset and Build, MSBuild will automatically match - Install mono-complete in WSL
- After installation, WSL cannot properly execute exe files. Need to add this code to WSL's
~/.profile, which will automatically execute once to fix settings every time WSL starts:
- After installation, WSL cannot properly execute exe files. Need to add this code to WSL's
# https://github.com/microsoft/WSL/issues/5466
python.exe --version >/dev/null 2>&1 || \
sudo update-binfmts --disable cli- File paths in sln and csproj under WSL are still in Windows format, need to replace with WSL format starting with
/mnt/c/ - Add this code to the
Assets/Editor/directory, then go to Preferences → External Tools to regenerate project files once. Now it will generate an additional batch of WSL-specific project files each time:
using System.IO;
using System.Text.RegularExpressions;
using UnityEditor;
public class WSLProjectGenerator : AssetPostprocessor
{
public static string OnGeneratedCSProject(string path, string content)
{
string wslProjectPath = path.Replace(".csproj", "-wsl.csproj");
string wslContent = content.Replace(".csproj", "-wsl.csproj");
wslContent = ConvertToWSLPath(wslContent);
File.WriteAllText(wslProjectPath, wslContent);
return content;
}
public static string OnGeneratedSlnSolution(string path, string content)
{
string wslSolutionPath = path.Replace(".sln", "-wsl.sln");
string wslContent = content.Replace(".csproj", "-wsl.csproj");
wslContent = ConvertToWSLPath(wslContent);
File.WriteAllText(wslSolutionPath, wslContent);
return content;
}
private static string ConvertToWSLPath(string fileContent)
{
fileContent = Regex.Replace(fileContent, @"([A-Z]):\\", match => $"/mnt/{match.Groups[1].Value.ToLower()}/");
return fileContent.Replace("\\", "/");
}
}- Settings → Keymap → search for "escape" and find "Plugins/Terminal/Escape", clear the shortcut
- This problem suddenly appeared during normal use, never found the cause, finally switched to VSCode
- Requests from WSL are blocked by Windows firewall. Need to find WSL's IP (
ip addr show eth0), then create a new inbound rule in "Windows Defender Firewall with Advanced Security" → Custom, allowing all access from this IP - But sometimes it doesn't take effect immediately. I also tried operations like
netsh advfirewall resetto reset the firewall, not sure which operation actually worked
- Install .NET 9.0 according to Microsoft's official documentation
- Install mono-complete
- Let VSCode select wsl.sln for loading
- Choose Rider instead of VSCode in Preferences for project file generation (otherwise the language server will error due to Windows absolute path NuGet references, no solution found)
.vscode/settings.json
{
"dotnet.preferCSharpExtension": true,
"dotnet.defaultSolution": "DemoProj-wsl.sln",
"omnisharp.defaultLaunchSolution": "DemoProj-wsl.sln"
...
}- Since WSL cannot monitor file changes in time, need to write a custom VS plugin + MCP server to let AI notify VSCode to refresh after each file modification
- You can directly use this plugin + script: https://github.com/Reekin/vscode-mcp-for-wsl-unity
- Let Unity open this bat file, passing parameters
"$(File)" $(Line):
@echo off
set win_path=%1
set wsl_path=%win_path:\=/%
set wsl_path=%wsl_path:C:=/mnt/c%
set wsl_path=%wsl_path:D:=/mnt/d%
set wsl_path=%wsl_path:E:=/mnt/e%
set wsl_path=%wsl_path:F:=/mnt/f%
set wsl_path=%wsl_path:G:=/mnt/g%
set wsl_path=%wsl_path:H:=/mnt/h%
set wsl_path=%wsl_path:I:=/mnt/i%
set wsl_path=%wsl_path:J:=/mnt/j%
wsl.exe code -r --goto "%wsl_path%:%2" & disown & exit- Reason is that the cs file is not automatically added to the csproj, need to regenerate project files
- Use my forked unity-mcp (https://github.com/Reekin/unity-mcp), by adding ProjectFilesRegenerator.cs from this repository to register a new tool
- Use vscode-mcp-for-wsl-unity
- Place the refresh-and-diagnose.sh from this repository anywhere in WSL (I put it in ~/bin/), register it as hooks
- This way, project updates and syntax checks will be automatically triggered after each file addition
"hooks": {
"PostToolUse": [
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "~/bin/refresh-and-diagnose.sh true"
}
]
},
{
"matcher": "Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "~/bin/refresh-and-diagnose.sh"
}
]
}
]
}- Write rules in
~/.claude/CLAUDE.md(how you want it to think), specify text editor in~/.claude/settings.json:
{
"env": {
"EDITOR": "code"
}
}-
Emphasize in rules that git commit must be executed after each modification to ensure we can undo incorrect changes
-
Use dll extractor MCP (https://github.com/Reekin/CSharpDllMetadataExtractor) to get the most accurate interface calling information, avoiding confusion from large model knowledge
-
Code Quality: Although the level of automation is higher (one sentence can complete larger tasks including testing, commits, and other complete processes), the writing quality is not much better than Cursor with R1PER5. Whether in Unity technology stack mastery or experience in game development framework design, it doesn't perform as well as in web development, occasionally writing implementations that would never be adopted in actual projects - either amateur or junior level.
-
Workflow Issues: Based on point 1, you can't dare to skip checks - every modification must be manually reviewed. So the workflow becomes: input command → wait dozens of seconds → review → adjust. Humans cannot break away from this cycle, so productivity doesn't improve, and you can't achieve what some people say about letting it run all night. Considering its writing level, overall efficiency actually decreases. And obviously this vibe coding work style really makes people dumber.
-
Limited IDE Control: The IDE MCP capabilities provided by the CC plugin seem to only include diff and diagnostic. High-frequency functions used by humans in development like F12 to view definitions, Shift+F12 to view references, etc., CC cannot do. Often you can only watch it stupidly execute multiple file search commands to find a class. Moreover, in cross-system usage scenarios, file changes cannot be perceived in time, and CC often gets outdated linter information. You can only wait for it to complete tasks, then go into Unity to compile before it can get correct compilation results, which seriously affects continuity.
-
Memory/Attention Issues: In real development processes, after we propose requirements and communicate with programmers to form conclusions, programmers will develop according to the discussion conclusions and deliver results that meet expectations. But in the collaboration process with CC, even if I clearly provide goals, technology choices, development principles and other information in the conversation, and have it recorded in project memory, after
/clearwhen it re-reads from memory, the understanding differs greatly from the previous conversation, giving implementations with very large deviations. Currently, it seems that CLAUDE.md under the project is not sufficient to support the "dialogue → form documentation → develop according to documentation" process. You must emphasize with prompts in each round of dialogue to have sufficient guiding effect. -
UI/UX Issues: GUI missing, poor input experience, Windows doesn't support image uploads, various experience detail issues.