Merge pull request #151 from Scriptwonder/master

Minor Bug Fix
main
Shutong Wu 2025-07-06 19:55:01 -04:00 committed by GitHub
commit 410b95ac41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 2 deletions

View File

@ -66,13 +66,15 @@ namespace UnityMcpBridge.Editor.Tools
/// </summary>
private static object ExecuteItem(JObject @params)
{
string menuPath = @params["menu_path"]?.ToString();
// Try both naming conventions: snake_case and camelCase
string menuPath = @params["menu_path"]?.ToString() ?? @params["menuPath"]?.ToString();
// string alias = @params["alias"]?.ToString(); // TODO: Implement alias mapping based on refactor plan requirements.
// JObject parameters = @params["parameters"] as JObject; // TODO: Investigate parameter passing (often not directly supported by ExecuteMenuItem).
if (string.IsNullOrWhiteSpace(menuPath))
{
return Response.Error("Required parameter 'menu_path' is missing or empty.");
return Response.Error("Required parameter 'menu_path' or 'menuPath' is missing or empty.");
}
// Validate against blacklist

View File

@ -891,6 +891,29 @@ namespace UnityMcpBridge.Editor.Tools
);
}
}
} else if (properties["_Color"] is JArray colorArr) //Current Prevention for systems that use _Color instead of color
{
try {
if (colorArr.Count >= 3)
{
Color newColor = new Color(
colorArr[0].ToObject<float>(),
colorArr[1].ToObject<float>(),
colorArr[2].ToObject<float>(),
colorArr.Count > 3 ? colorArr[3].ToObject<float>() : 1.0f
);
if (mat.HasProperty(propName) && mat.GetColor(propName) != newColor)
{
mat.SetColor(propName, newColor);
modified = true;
}
}
}
catch (Exception ex) {
Debug.LogWarning(
$"Error parsing color property '{propName}': {ex.Message}"
);
}
}
// Example: Set float property
if (properties["float"] is JObject floatProps)