Skip to content

set_component_property fails on array properties with 'Property not found' despite property existing #765

@CloudStrife7

Description

@CloudStrife7

Bug Description

When using manage_gameobject with action: set_component_property to modify array-type serialized fields on UdonSharp components, the operation fails with a paradoxical error:

Property 'menuNames' not found. Did you mean: menuNames?

The property clearly exists and is listed in the "Available" properties, but the setter logic fails to match it.

Reproduction Steps

  1. Have a GameObject with an UdonSharp component containing array fields (e.g., string[] menuNames)
  2. Attempt to set the property via MCP:
{
  "action": "set_component_property",
  "target": "Shell",
  "component_name": "DT_Shell",
  "component_properties": {
    "menuNames": { "value": ["STATS", "GITHUB", "DISCORD"] }
  }
}
  1. Observe the error in Unity console

Expected Behavior

The array property should be updated with the new values.

Actual Behavior

Operation fails with:

[ManageGameObject] Property 'menuNames' not found. Did you mean: menuNames? Available: [coreReference, DisableInteractive, enabled, hideFlags, inputKey, InteractionText, menuDescriptions, menuNames, menuTargets, menuTypes, name, rolesModule, runInEditMode, tag, useGUILayout]

Full Stack Trace

UnityEngine.Debug:LogWarning (object)
MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertiesInternal (UnityEngine.GameObject,string,Newtonsoft.Json.Linq.JObject,UnityEngine.Component) (at ./Library/PackageCache/com.coplaydev.unity-mcp@7.0.0/Editor/Tools/ManageGameObject.cs:1685)
MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertyOnTarget (Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.Linq.JToken,string) (at ./Library/PackageCache/com.coplaydev.unity-mcp@7.0.0/Editor/Tools/ManageGameObject.cs:1244)
MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at ./Library/PackageCache/com.coplaydev.unity-mcp@7.0.0/Editor/Tools/ManageGameObject.cs:191)
MCPForUnity.Editor.Tools.CommandRegistry:ExecuteCommand (string,Newtonsoft.Json.Linq.JObject,System.Threading.Tasks.TaskCompletionSource`1<string>) (at ./Library/PackageCache/com.coplaydev.unity-mcp@7.0.0/Editor/Tools/CommandRegistry.cs:248)
MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at ./Library/PackageCache/com.coplaydev.unity-mcp@7.0.0/Editor/MCPForUnityBridge.cs:954)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Environment

  • Unity MCP Package: v7.0.0
  • Unity: 2022.3.22f1
  • Component Type: UdonSharp (VRChat SDK)
  • Property Types Tested: string[], UdonSharpBehaviour[]

Analysis

The property name lookup succeeds (it appears in "Available" and in "Did you mean"), but the actual property setter fails. Likely causes:

  1. Array-type properties may not be supported by SetComponentPropertiesInternal
  2. UdonSharp components use Odin serialization which may require different reflection/access patterns
  3. The property matching logic in the setter differs from the property listing logic

Workaround

Currently editing the serialized YAML files (prefab/scene) directly or using Unity Inspector manually.

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