You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's test: Can you trigger Unity's script compilation?
● No, I cannot trigger Unity's script compilation through Unity MCP.
Why not:
Unity MCP can create/edit scripts via file operations
dotnet build compiles to Temp/bin/Debug/ (not usable by Unity)
Unity compiles to Library/ScriptAssemblies/ (only happens in Unity Editor)
File system operations (touch, editing files) don't auto-trigger compilation via MCP
No reimport_asset or force_compile action exists in Unity MCP
Current workflow:
I create/edit script via Unity MCP
User opens Unity Editor
Unity auto-detects changes and compiles
Component becomes available
What would enable auto-compilation:
Unity MCP would need to add actions like reimport_asset() or trigger_compilation() to programmatically invoke
Unity's AssetDatabase refresh.
Is that true? Or do I just have a problem locally?
Thanks!
Hey! I believe that's true, it's not a single function we expose via MCP. Why would you like it exposed? Usually Unity does it by itself after script changes are saved for e.g.
I believe Claude Code created a MonoBehaviour and wanted to attach it to a GameObject (directly in the editor). But without Unity's script compilation this results in an error, because the script is unknown to Unity.
So currently Claude Code creates the files, then displays a ToDo list for me, e.g. "1. Run Unity's compilation, then attach the new script to GameObject xy".
I understand. I guess Unity wasn't in focus? So no domain reload happened, and the script could not have been attached. The better flow would be for CC to write all the scripts necessary, do a domain reload, check the editor state, and then when ready attach the scripts.
I think this is something we can add, or revisit how we write files. Thanks for sharing
Yes, Unity wasn't in focus.
Thanks! That would be great. In the meantime I'll try to teach it this exact flow, where it waits until I focus the editor.
Activity
msanatan commentedon Oct 6, 2025
Hey! I believe that's true, it's not a single function we expose via MCP. Why would you like it exposed? Usually Unity does it by itself after script changes are saved for e.g.
Doidel commentedon Oct 6, 2025
I believe Claude Code created a MonoBehaviour and wanted to attach it to a GameObject (directly in the editor). But without Unity's script compilation this results in an error, because the script is unknown to Unity.
So currently Claude Code creates the files, then displays a ToDo list for me, e.g. "1. Run Unity's compilation, then attach the new script to GameObject xy".
msanatan commentedon Oct 6, 2025
I understand. I guess Unity wasn't in focus? So no domain reload happened, and the script could not have been attached. The better flow would be for CC to write all the scripts necessary, do a domain reload, check the editor state, and then when ready attach the scripts.
I think this is something we can add, or revisit how we write files. Thanks for sharing
Doidel commentedon Oct 6, 2025
Yes, Unity wasn't in focus.
Thanks! That would be great. In the meantime I'll try to teach it this exact flow, where it waits until I focus the editor.