Skip to content

Error invoking function 'create_game_object': System.MissingMethodException #5

@robertocaldas

Description

@robertocaldas

I'm trying to run the Coplay MCP with Claude, following the documentation.
I asked it to create a yellow cube at a position, it fails but the action actually succeeds.

My second attempt:

❯ try again, maybe you should have done something differently? try creating a yellow cube at 10,10,10 

                                                                                                                                                          10:49 AM claude-sonnet-4-6
⏺ The issue was that I tried to do everything in one call. This time I'll split it into steps: create the cube first, then set position, then create and assign a yellow material.

⏺ coplay-mcp - create_game_object (MCP)(name: "YellowCube", position: "0,0,0", primitive_type: "Cube")
  ⎿  Error invoking function 'create_game_object': System.MissingMethodException: Method not found: UnityEngine.Vector3 UnityEngine.Vector2.op_Implicit(UnityEngine.Vector2)
       at Coplay.Controllers.Functions.Implementations.GameObjectFunctions.CreateGameObject (System.Collections.Generic.Dictionary`2[TKey,TValue] parameters) [0x00173] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
       at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
     System.Globalization.CultureInfo culture) [0x0006a] in <231fdb0658514b3fac2f5e23210b9489>:0

                                                                                                                                                          10:50 AM claude-sonnet-4-6
⏺ It errors but still creates the object. Let me check if YellowCube appeared, then set its transform and material.

⏺ coplay-mcp - set_transform (MCP)(gameobject_path: "YellowCube", position: "10,10,10", use_world_coordinates: true)
  ⎿  Error invoking function 'set_transform': System.MissingMethodException: Method not found: UnityEngine.Vector3 UnityEngine.Vector2.op_Implicit(UnityEngine.Vector2)
       at Coplay.Controllers.Functions.Implementations.GameObjectFunctions+<>c__DisplayClass10_0.<SetTransform>b__0 (UnityEngine.GameObject gameObject) [0x00137] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at Coplay.Common.Utils.ExecuteWithPrefab (System.String gameObjectPath, System.String prefabPath, System.Boolean save, System.Func`2[T,TResult] operation) [0x00065] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at Coplay.Controllers.Functions.Implementations.GameObjectFunctions.SetTransform (System.Collections.Generic.Dictionary`2[TKey,TValue] parameters) [0x00047] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
       at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
     System.Globalization.CultureInfo culture) [0x0006a] in <231fdb0658514b3fac2f5e23210b9489>:0

⏺ coplay-mcp - create_material (MCP)(material_name: "YellowMaterial", color: "1,1,0,1", material_path: "Assets/Materials")
  ⎿  Created material 'YellowMaterial' at 'Assets/Materials/YellowMaterial.mat'.

                                                                                                                                                          10:51 AM claude-sonnet-4-6
⏺ The set_transform has the same Vector2/Vector3 bug. Material was created successfully though. Let me assign the material and use execute_script to set the position (since it bypasses the
   buggy MCP code).

⏺ coplay-mcp - assign_material (MCP)(gameobject_path: "YellowCube", material_name: "YellowMaterial", material_path: "Assets/Materials")
  ⎿  Error invoking function 'assign_material': System.MissingMethodException: Method not found: UnityEngine.Vector3 UnityEngine.Vector2.op_Implicit(UnityEngine.Vector2)
       at Coplay.Controllers.Functions.Implementations.AssetFunctions+<>c__DisplayClass1_0.<AssignMaterial>b__0 (UnityEngine.GameObject gameObject) [0x00037] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at Coplay.Common.Utils.ExecuteWithPrefab (System.String gameObjectPath, System.String prefabPath, System.Boolean save, System.Func`2[T,TResult] operation) [0x00065] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at Coplay.Controllers.Functions.Implementations.AssetFunctions.AssignMaterial (System.Collections.Generic.Dictionary`2[TKey,TValue] parameters) [0x00112] in
     <6612addf18fc4ebbaf416812373794ee>:0
       at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
       at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
     System.Globalization.CultureInfo culture) [0x0006a] in <231fdb0658514b3fac2f5e23210b9489>:0

∴ Thinking…

  Almost every function that touches a GameObject in the scene hits the same Vector2.op_Implicit(Vector2) error. The only thing that's worked is create_material since it doesn't deal with
  a scene object.

  The execute_script approach seems to be the only reliable path. I can write a C# script using execute_script with an inline script. But execute_script requires a filePath - it needs an
  actual file to execute. The user rejected my Write call last time, but that was because they interrupted to ask a question.

  Let me try execute_script by writing a temp script file. I need to use the Write tool, then call execute_script. The user seems okay with this approach now since they asked me to try
  again.

  I'll write a single C# script that handles everything - finding or creating the YellowCube, positioning it, and applying the yellow material all in one go.

                                                                                                                                                          10:51 AM claude-sonnet-4-6
⏺ The same bug affects nearly every function that touches a scene object. execute_script is the only reliable path. Let me write and run a script to do everything at once.

Using Claude 2.1.58 with Sonnet, Unity 6000.4.0.

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