Skip to content

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

Closed

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/[email protected]/Editor/Tools/ManageGameObject.cs:1685)
MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertyOnTarget (Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.Linq.JToken,string) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1244)
MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:191)
MCPForUnity.Editor.Tools.CommandRegistry:ExecuteCommand (string,Newtonsoft.Json.Linq.JObject,System.Threading.Tasks.TaskCompletionSource`1<string>) (at ./Library/PackageCache/[email protected]/Editor/Tools/CommandRegistry.cs:248)
MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at ./Library/PackageCache/[email protected]/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.

Activity

  1. CloudStrife7 commented on Feb 17, 2026

    @CloudStrife7
    Author

    Additional Error Logs

    The error occurs for each array property attempted. Here are the full console outputs:

    [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]
    UnityEngine.Debug:LogWarning (object)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertiesInternal (UnityEngine.GameObject,string,Newtonsoft.Json.Linq.JObject,UnityEngine.Component) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1685)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertyOnTarget (Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.Linq.JToken,string) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1244)
    MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:191)
    MCPForUnity.Editor.Tools.CommandRegistry:ExecuteCommand (string,Newtonsoft.Json.Linq.JObject,System.Threading.Tasks.TaskCompletionSource`1<string>) (at ./Library/PackageCache/[email protected]/Editor/Tools/CommandRegistry.cs:248)
    MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at ./Library/PackageCache/[email protected]/Editor/MCPForUnityBridge.cs:954)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
    
    [ManageGameObject] Property 'menuDescriptions' not found. Did you mean: menuDescriptions? Available: [coreReference, DisableInteractive, enabled, hideFlags, inputKey, InteractionText, menuDescriptions, menuNames, menuTargets, menuTypes, name, rolesModule, runInEditMode, tag, useGUILayout]
    UnityEngine.Debug:LogWarning (object)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertiesInternal (UnityEngine.GameObject,string,Newtonsoft.Json.Linq.JObject,UnityEngine.Component) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1685)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertyOnTarget (Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.Linq.JToken,string) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1244)
    MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:191)
    MCPForUnity.Editor.Tools.CommandRegistry:ExecuteCommand (string,Newtonsoft.Json.Linq.JObject,System.Threading.Tasks.TaskCompletionSource`1<string>) (at ./Library/PackageCache/[email protected]/Editor/Tools/CommandRegistry.cs:248)
    MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at ./Library/PackageCache/[email protected]/Editor/MCPForUnityBridge.cs:954)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
    
    [ManageGameObject] Property 'menuTypes' not found. Did you mean: menuTypes? Available: [coreReference, DisableInteractive, enabled, hideFlags, inputKey, InteractionText, menuDescriptions, menuNames, menuTargets, menuTypes, name, rolesModule, runInEditMode, tag, useGUILayout]
    UnityEngine.Debug:LogWarning (object)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertiesInternal (UnityEngine.GameObject,string,Newtonsoft.Json.Linq.JObject,UnityEngine.Component) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1685)
    MCPForUnity.Editor.Tools.ManageGameObject:SetComponentPropertyOnTarget (Newtonsoft.Json.Linq.JObject,Newtonsoft.Json.Linq.JToken,string) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:1244)
    MCPForUnity.Editor.Tools.ManageGameObject:HandleCommand (Newtonsoft.Json.Linq.JObject) (at ./Library/PackageCache/[email protected]/Editor/Tools/ManageGameObject.cs:191)
    MCPForUnity.Editor.Tools.CommandRegistry:ExecuteCommand (string,Newtonsoft.Json.Linq.JObject,System.Threading.Tasks.TaskCompletionSource`1<string>) (at ./Library/PackageCache/[email protected]/Editor/Tools/CommandRegistry.cs:248)
    MCPForUnity.Editor.MCPForUnityBridge:ProcessCommands () (at ./Library/PackageCache/[email protected]/Editor/MCPForUnityBridge.cs:954)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
    

    Key Observation

    The error message is self-contradictory:

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

    The property lookup for "Did you mean" suggestions works, but the actual property setter fails on the same property name.

    Root Cause Theory

    Looking at line 1685 in ManageGameObject.cs, the SetComponentPropertiesInternal method likely:

    1. Successfully enumerates available properties (used for "Did you mean" and "Available" list)
    2. Fails when actually trying to get/set the property via reflection or SerializedProperty
    3. The failure may be because array-type properties require different handling (e.g., SerializedProperty.arraySize and element-by-element assignment)

    Suggested Fix

    In SetComponentPropertiesInternal, add support for array properties by:

    1. Detecting if the target property is an array type
    2. Using SerializedProperty array APIs: arraySize, GetArrayElementAtIndex(), etc.
    3. Converting the incoming JSON array to the appropriate element types

    Current Workarounds

    1. Edit in Unity Inspector - Manually modify array fields
    2. Edit prefab/scene YAML directly - Risky but works for automation
    3. Create a custom Editor script - Use [MenuItem] to expose array modification operations
  2. dsarno commented on Feb 17, 2026

    @dsarno
    Collaborator

    Thanks for the detailed report @CloudStrife7 — this was a great catch. The paradoxical "not found / did you mean: [exact same name]" error was definitely confusing.

    Fixed in PR #766 (merged to beta). The fix will be available in the next beta release after 9.4.7-beta.3. Summary of changes:

    • Conversion failures now report the actual error (e.g. "Failed to set property 'spatialBlend': Unexpected token: StartArray") instead of misleading "not found"
    • Added SerializedProperty fallback so array properties that reflection can't handle are set via Unity's serialization system
    • Nonexistent properties still correctly report "not found" with suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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