Skip to content

Could not load the file 'Assembly-CSharp-Editor' #258

@wangcan26

Description

@wangcan26

Through MCP, I instructed the LLM to generate a script component, and it works indeed.
However, when mounting the component via MCP's add_component, it reports the following error:

[ManageGameObject] Action 'add_component' failed: System.IO.FileNotFoundException: Could not load the file 'Assembly-CSharp-Editor'.
File name: 'Assembly-CSharp-Editor'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly, System.Threading.StackCrawlMark& stackMark) [0x00016] in <fd98429b8c6c4f82ba907b21c76e6375>:0 
  at System.AppDomain.Load (System.String assemblyString) [0x00002] in <fd98429b8c6c4f82ba907b21c76e6375>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain.Load(string)
  at System.Reflection.Assembly.Load (System.String assemblyString) [0x00005] in <fd98429b8c6c4f82ba907b21c76e6375>:0 
  at MCPForUnity.Editor.Tools.ManageGameObject.FindType (System.String typeName) [0x00192] in /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/Tools/ManageGameObject.cs:2096 
  at MCPForUnity.Editor.Tools.ManageGameObject.AddComponentInternal (UnityEngine.GameObject targetGo, System.String typeName, Newtonsoft.Json.Linq.JObject properties) [0x00000] in /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/Tools/ManageGameObject.cs:1318 
  at MCPForUnity.Editor.Tools.ManageGameObject.AddComponentToTarget (Newtonsoft.Json.Linq.JObject params, Newtonsoft.Json.Linq.JToken targetToken, System.String searchMethod) [0x00100] in /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/Tools/ManageGameObject.cs:990 
  at MCPForUnity.Editor.Tools.ManageGameObject.HandleCommand (Newtonsoft.Json.Linq.JObject params) [0x0043e] in /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/Tools/ManageGameObject.cs:138 
UnityEngine.Debug:LogError (object)
MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/Tools/ManageGameObject.cs:150)
MCPForUnity.Editor.MCPForUnityBridge:ExecuteCommand (MCPForUnity.Editor.Models.Command) (at /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/MCPForUnityBridge.cs:805)
MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at /Volumes/ExternSpace/Unity/unity-mcp/UnityMcpBridge/Editor/MCPForUnityBridge.cs:713)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:384)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions