Minor Fix on Advanced Setting UI#459
Conversation
* Update the .Bat file to include runtime folder * Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change.
String to Int for consistency
Allows users to generate/compile codes during Playmode
Upload the unity_claude_skill that can be uploaded to Claude for a combo of unity-mcp-skill.
1. Fix Original Roslyn Compilation Custom Tool to fit the V8 standard 2. Add a new panel in the GUI to see and toggle/untoggle the tools. The toggle feature will be implemented in the future, right now its implemented here to discuss with the team if this is a good feature to add; 3. Add few missing summary in certain tools
This reverts commit ae8cfe5.
This reverts commit f423c2f.
Merge and use the previous PR's solution to solve the windows issue.
Fix the layout problem of manage_script in the panel
Tested object generation/modification with batch and it works perfectly! We should push and let users test for a while and see PS: I tried both VS Copilot and Claude Desktop. Claude Desktop works but VS Copilot does not due to the nested structure of batch. Will look into it more.
Update on Batch
* Enable Camera Capture through both play and editor mode Notes: Because the standard ScreenCapture.CaptureScreenshot does not work in editor mode, so we use ScreenCapture.CaptureScreenshotIntoRenderTexture to enable it during play mode. * user can access the camera access through the tool menu, or through direct LLM calling. Both tested on Windows with Claude Desktop.
nitpicking changes
Similar to deploy.bat, but sideload it to MCP For Unity for easier deployment inside Unity menu.
Add a browse for server and make the source input more than readonly
WalkthroughThe PR introduces a Git URL browsing button in the MCP Settings UI that opens a folder dialog for selection, persists the chosen path via EditorPrefs, and adds validation logic to the deployment source path field with error handling and service integration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.uxml (1)
38-38: Consider UX clarity for the browse button.The button labeled "Select" opens a folder panel (per the CS implementation), but the field label "Server Path/URL:" and placeholder text suggest that both local paths and Git URLs (e.g.,
git+https://...) are valid inputs. Users wanting to specify a Git URL must manually type it rather than browse. This is functional but may cause brief confusion.Consider either:
- Renaming the button to "Browse Local..." to clarify it's for local paths only, or
- Adding a help tooltip to the button indicating it's for local folder selection
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.cs (1)
276-287: Remove redundant EditorPrefs update and event invocations.Lines 282-284 duplicate work already performed by the
RegisterValueChangedCallbackon Lines 131-144. WhengitUrlOverride.valueis set on Line 281, the callback automatically:
- Updates EditorPrefs
- Invokes
OnGitUrlChanged- Invokes
OnHttpServerCommandUpdateRequestedThen Lines 282-284 repeat these operations, causing events to fire twice.
Note: The
clearGitUrlButtonhandler (Lines 146-152) has the same redundancy pattern, so this is consistent with existing code. However, both handlers should be fixed for correctness and efficiency.Apply this diff to remove redundancy:
private void OnBrowseGitUrlClicked() { string picked = EditorUtility.OpenFolderPanel("Select Server folder", string.Empty, string.Empty); if (!string.IsNullOrEmpty(picked)) { gitUrlOverride.value = picked; - EditorPrefs.SetString(EditorPrefKeys.GitUrlOverride, picked); - OnGitUrlChanged?.Invoke(); - OnHttpServerCommandUpdateRequested?.Invoke(); McpLog.Info($"Server source override set to: {picked}"); } }Consider applying the same fix to the clear button handler:
clearGitUrlButton.clicked += () => { gitUrlOverride.value = string.Empty; - EditorPrefs.DeleteKey(EditorPrefKeys.GitUrlOverride); - OnGitUrlChanged?.Invoke(); - OnHttpServerCommandUpdateRequested?.Invoke(); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.cs(5 hunks)MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.uxml(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.cs (4)
MCPForUnity/Editor/Services/MCPServiceLocator.cs (1)
MCPServiceLocator(11-91)MCPForUnity/Editor/Services/IPackageDeploymentService.cs (2)
SetStoredSourcePath(8-8)GetStoredSourcePath(7-7)MCPForUnity/Editor/Services/PackageDeploymentService.cs (2)
SetStoredSourcePath(23-27)GetStoredSourcePath(18-21)MCPForUnity/Editor/Constants/EditorPrefKeys.cs (1)
EditorPrefKeys(7-48)
🔇 Additional comments (4)
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.uxml (1)
51-51: LGTM!Removing
readonlyallows manual path entry, which pairs well with the validation callback added in the CS file (lines 154-171). This gives users flexibility to either browse or type paths directly.MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.cs (3)
31-31: LGTM!Standard UIElements field declaration and caching pattern, consistent with existing button fields in the class.
Also applies to: 80-80
129-129: LGTM!Standard callback registration pattern consistent with other button handlers in the class.
294-294: LGTM!Good use of the null-coalescing operator for cleaner, more idiomatic code.
| deploySourcePath.RegisterValueChangedCallback(evt => | ||
| { | ||
| string path = evt.newValue?.Trim(); | ||
| if (string.IsNullOrEmpty(path) || path == "Not set") | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| try | ||
| { | ||
| MCPServiceLocator.Deployment.SetStoredSourcePath(path); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| EditorUtility.DisplayDialog("Invalid Source", ex.Message, "OK"); | ||
| UpdateDeploymentSection(); | ||
| } | ||
| }); |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Address inconsistency and fragile string check.
Two concerns with this validation callback:
-
Fragile string literal check (Line 157): The hard-coded
"Not set"string is not set anywhere in the provided code and could break if display text changes. Consider removing this check and relying solely on thestring.IsNullOrEmpty(path)check. -
Inconsistent UI refresh: On success,
UpdateDeploymentSection()is not called, but on error it is (Line 169). In contrast,OnBrowseDeploySourceClicked(Lines 311-331) callsUpdateDeploymentSection()in both success and error cases. While the TextField itself already displays the user's input, other UI elements likedeployStatusLabelmay need updating to reflect success.
Apply this diff to improve consistency:
deploySourcePath.RegisterValueChangedCallback(evt =>
{
string path = evt.newValue?.Trim();
- if (string.IsNullOrEmpty(path) || path == "Not set")
+ if (string.IsNullOrEmpty(path))
{
return;
}
try
{
MCPServiceLocator.Deployment.SetStoredSourcePath(path);
+ SetDeployStatus($"Source set: {path}");
}
catch (Exception ex)
{
EditorUtility.DisplayDialog("Invalid Source", ex.Message, "OK");
- UpdateDeploymentSection();
+ SetDeployStatus("Invalid source path");
}
+
+ UpdateDeploymentSection();
});Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.cs around
lines 154 to 171, remove the fragile hard-coded "Not set" check and rely only on
string.IsNullOrEmpty(path) after trimming; then ensure UpdateDeploymentSection()
is called after a successful SetStoredSourcePath(path) as well as in the catch
block so the UI is refreshed consistently on both success and error (retain the
EditorUtility.DisplayDialog on exception and keep exception message handling).
Refine the Server/Source deployment
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.