forked from CoplayDev/unity-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Auto-select sole Unity instance via PluginHub/stdio and add tests #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6b219b1
Fix manage_material create to apply color
dsarno d68989c
Enhance add_component to support componentProperties with string arra…
dsarno cb6d90b
Fix material create cleanup on early return
dsarno bdec1e2
Avoid redundant color assignment
dsarno e4dc7c6
Merge pull request #113 from dsarno/codex/fix-memory-leak-in-managema…
dsarno 20c1fff
Fix color token apply logic
dsarno a09bb2a
Merge pull request #114 from dsarno/codex/fix-color-conflict-detectio…
dsarno 57e30b4
Prefer PluginHub for HTTP, limit stdio auto-select, and tighten excep…
dsarno 14d08f4
Auto-select sole Unity instance via PluginHub/stdio and add tests
dsarno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider explicit error when specified colorProperty doesn't exist.
When a user explicitly specifies
colorPropertybut that property doesn't exist on the material, the code silently falls back to_BaseColoror_Color. This differs fromSetMaterialColor(line 192), which returns an error in similar cases.Consider adding an explicit check and error return when the user-specified property doesn't exist:
🔎 Suggested improvement for explicit property validation
if (shouldApplyColor) { Color color; try { color = MaterialOps.ParseColor(colorToken, ManageGameObject.InputSerializer); } catch (Exception e) { return new { status = "error", message = $"Invalid color format: {e.Message}" }; } - if (!string.IsNullOrEmpty(colorProperty) && material.HasProperty(colorProperty)) + if (!string.IsNullOrEmpty(colorProperty)) { - material.SetColor(colorProperty, color); + if (material.HasProperty(colorProperty)) + { + material.SetColor(colorProperty, color); + } + else + { + return new { status = "error", message = $"Specified color property '{colorProperty}' does not exist on shader {shaderName}" }; + } } else if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", color); } else if (material.HasProperty("_Color")) { material.SetColor("_Color", color); } else { - Debug.LogWarning( - $"Could not find suitable color property to apply color during material creation at {materialPath}" - ); + return new { status = "error", message = "Could not find suitable color property (_BaseColor or _Color) on shader" }; } }🤖 Prompt for AI Agents