unity-mcp/MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uxml

146 lines
9.3 KiB
Plaintext
Raw Normal View History

New UI and work without MCP server embedded (#313) * First pass at new UI * Point to new UI * Refactor: New Service-Based MCP Editor Window Architecture We separate the business logic from the UI rendering of the new editor window with new services. I didn't go full Dependency Injection, not sure if I want to add those deps to the install as yet, but service location is fairly straightforward. Some differences with the old window: - No more Auto-Setup, users will manually decide what they want to do - Removed Python detection warning, we have a setup wizard now - Added explicit path overrides for `uv` and the MCP server itself * style: add flex-shrink and overflow handling to improve UI element scaling * fix: update UI configuration and visibility when client status changes * feat: add menu item to open legacy MCP configuration window * refactor: improve editor window lifecycle handling with proper update subscription * feat: add auto-verification of bridge health when connected * fix: update Claude Code MCP server registration to use lowercase unityMCP name and correct the manual installation instructions * fix: add Claude CLI directory to PATH for node/nvm environments * Clarify how users will see MCP tools * Add a keyboard shortcut to open the window * feat: add server download UI and improve installation status messaging This is needed for the Unity Asset Store, which doesn't have the Python server embedded. * feat: add dynamic asset path detection to support both Package Manager and Asset Store installations * fix: replace unicode emojis with escaped characters in status messages * feat: add server package creation and GitHub release publishing to version bump workflow * fix: add v prefix to server package filename in release workflow * Fix download location * style: improve dropdown and settings layout responsiveness with flex-shrink and max-width * feat: add package.json version detection and refactor path utilities * refactor: simplify imports and use fully qualified names in ServerInstaller.cs * refactor: replace Unity Debug.Log calls with custom McpLog class * fix: extract server files to temp directory before moving to final location * docs: add v6 UI documentation and screenshots with service architecture overview * docs: add new UI Toolkit-based editor window with service architecture and path overrides * feat: improve package path resolution to support Package Manager and Asset Store installations * Change Claude Code's casing back to "UnityMCP" There's no need to break anything as yet * fix: update success dialog text to clarify manual bridge start requirement * refactor: move RefreshDebounce and ManageScriptRefreshHelpers classes inside namespace * feat: add Asset Store fallback path detection for package root lookup * fix: update server installation success message to be more descriptive * refactor: replace Unity Debug.Log calls with custom McpLog utility * fix: add file existence check before opening configuration file * refactor: simplify asset path handling and remove redundant helper namespace references * docs: update code block syntax highlighting in UI changes doc * docs: add code block syntax highlighting for file structure example * feat: import UnityEditor.UIElements namespace for UI components for Unity 2021 compatibility * refactor: rename Python server references to MCP server for consistency * fix: reset client status label color after error state is cleared * Replace the phrase "Python server" with "MCP server" * MInor doc clarification * docs: add path override methods for UV and Claude CLI executables * docs: update service locator registration method name from SetCustomImplementation to Register
2025-10-11 15:08:16 +08:00
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
<ui:ScrollView name="root-container" style="padding: 16px;">
<!-- Title -->
<ui:Label text="MCP For Unity" name="title" class="title" />
<!-- Settings Section -->
<ui:VisualElement name="settings-section" class="section">
<ui:Label text="Settings" class="section-title" />
<ui:VisualElement class="section-content">
<ui:VisualElement class="setting-row">
<ui:Label text="Version:" class="setting-label" />
Use secure unity version (#321) * chore: update Unity version from 2021.3.45f1 to 2021.3.45f2 Older Unity version had the security vulnerability, so we update it * feat: add dynamic version display in editor window settings * refactor: remove manual license file handling from Unity test workflow * Revert "refactor: remove manual license file handling from Unity test workflow" This reverts commit a6ab3d982e792039c01a4afd353e61c7e22a2c3c. * feat: add Unity license credentials to Docker containers in CI workflow * refactor: replace manual Unity license activation with game-ci/unity-activator * refactor: simplify Unity CI setup by removing game-ci activation and using built-in license handling * fix: improve Unity license activation in CI by using unityci image's built-in activation flow * refactor: activate once in a temporary container, then reuse the license in the long-running container Now we got the license secret to be read, we got this error: "Machine bindings don't match". So it seems that the license I generated locally can't be used. So we need to activate the license within the container * Revert "refactor: activate once in a temporary container, then reuse the license in the long-running container" This reverts commit f6a9aa68f910df37cede6f83d535098be2a9f80b. * Revert "fix: improve Unity license activation in CI by using unityci image's built-in activation flow" This reverts commit a9f4c0223bc3467442be6dafa1d9303479623a7c. * Revert "refactor: simplify Unity CI setup by removing game-ci activation and using built-in license handling" This reverts commit 4e5ffc0051a7b15b9d87ecaa06fa646f8b13b0b9. * Revert "refactor: replace manual Unity license activation with game-ci/unity-activator" This reverts commit e9520ee768c4e9d48efc81b1a9c3cac3986cc96a. * Revert "feat: add Unity license credentials to Docker containers in CI workflow" This reverts commit 01b8879e35baaf88239988b51e6d4f1e5daaa1cf.
2025-10-18 01:35:47 +08:00
<ui:Label text="..." name="version-label" class="setting-value" />
New UI and work without MCP server embedded (#313) * First pass at new UI * Point to new UI * Refactor: New Service-Based MCP Editor Window Architecture We separate the business logic from the UI rendering of the new editor window with new services. I didn't go full Dependency Injection, not sure if I want to add those deps to the install as yet, but service location is fairly straightforward. Some differences with the old window: - No more Auto-Setup, users will manually decide what they want to do - Removed Python detection warning, we have a setup wizard now - Added explicit path overrides for `uv` and the MCP server itself * style: add flex-shrink and overflow handling to improve UI element scaling * fix: update UI configuration and visibility when client status changes * feat: add menu item to open legacy MCP configuration window * refactor: improve editor window lifecycle handling with proper update subscription * feat: add auto-verification of bridge health when connected * fix: update Claude Code MCP server registration to use lowercase unityMCP name and correct the manual installation instructions * fix: add Claude CLI directory to PATH for node/nvm environments * Clarify how users will see MCP tools * Add a keyboard shortcut to open the window * feat: add server download UI and improve installation status messaging This is needed for the Unity Asset Store, which doesn't have the Python server embedded. * feat: add dynamic asset path detection to support both Package Manager and Asset Store installations * fix: replace unicode emojis with escaped characters in status messages * feat: add server package creation and GitHub release publishing to version bump workflow * fix: add v prefix to server package filename in release workflow * Fix download location * style: improve dropdown and settings layout responsiveness with flex-shrink and max-width * feat: add package.json version detection and refactor path utilities * refactor: simplify imports and use fully qualified names in ServerInstaller.cs * refactor: replace Unity Debug.Log calls with custom McpLog class * fix: extract server files to temp directory before moving to final location * docs: add v6 UI documentation and screenshots with service architecture overview * docs: add new UI Toolkit-based editor window with service architecture and path overrides * feat: improve package path resolution to support Package Manager and Asset Store installations * Change Claude Code's casing back to "UnityMCP" There's no need to break anything as yet * fix: update success dialog text to clarify manual bridge start requirement * refactor: move RefreshDebounce and ManageScriptRefreshHelpers classes inside namespace * feat: add Asset Store fallback path detection for package root lookup * fix: update server installation success message to be more descriptive * refactor: replace Unity Debug.Log calls with custom McpLog utility * fix: add file existence check before opening configuration file * refactor: simplify asset path handling and remove redundant helper namespace references * docs: update code block syntax highlighting in UI changes doc * docs: add code block syntax highlighting for file structure example * feat: import UnityEditor.UIElements namespace for UI components for Unity 2021 compatibility * refactor: rename Python server references to MCP server for consistency * fix: reset client status label color after error state is cleared * Replace the phrase "Python server" with "MCP server" * MInor doc clarification * docs: add path override methods for UV and Claude CLI executables * docs: update service locator registration method name from SetCustomImplementation to Register
2025-10-11 15:08:16 +08:00
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:Label text="Show Debug Logs:" class="setting-label" />
<ui:Toggle name="debug-logs-toggle" class="setting-toggle" />
</ui:VisualElement>
<ui:VisualElement class="setting-column">
<ui:Label text="Script Validation Level:" class="setting-label" />
<uie:EnumField name="validation-level" class="setting-dropdown" />
<ui:Label name="validation-description" class="validation-description" />
</ui:VisualElement>
<!-- Advanced Settings (Collapsible) -->
<ui:Foldout name="advanced-settings-foldout" text="Advanced Settings" class="advanced-settings-foldout">
<ui:VisualElement class="advanced-settings-content">
<ui:Label text="Path Overrides (leave empty for auto-detection):" class="advanced-label" />
<!-- MCP Server Path Override -->
<ui:VisualElement class="override-row">
<ui:Label text="MCP Server Path:" class="override-label" />
<ui:VisualElement class="status-indicator-small" name="mcp-server-path-status" />
</ui:VisualElement>
<ui:VisualElement class="path-override-controls">
<ui:TextField name="python-path-override" readonly="true" class="override-field" />
<ui:Button name="browse-python-button" text="Browse" class="icon-button" />
<ui:Button name="clear-python-button" text="Clear" class="icon-button" />
</ui:VisualElement>
<!-- UV Path Override -->
<ui:VisualElement class="override-row">
<ui:Label text="UV Path:" class="override-label" />
<ui:VisualElement class="status-indicator-small" name="uv-path-status" />
</ui:VisualElement>
<ui:VisualElement class="path-override-controls">
<ui:TextField name="uv-path-override" readonly="true" class="override-field" />
<ui:Button name="browse-uv-button" text="Browse" class="icon-button" />
<ui:Button name="clear-uv-button" text="Clear" class="icon-button" />
</ui:VisualElement>
</ui:VisualElement>
</ui:Foldout>
</ui:VisualElement>
</ui:VisualElement>
<!-- Connection Section -->
<ui:VisualElement name="connection-section" class="section">
<ui:Label text="Connection" class="section-title" />
<ui:VisualElement class="section-content">
<ui:VisualElement class="setting-row">
<ui:Label text="Protocol:" class="setting-label" />
<uie:EnumField name="protocol-dropdown" class="setting-dropdown-inline" />
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:Label text="Unity Port:" class="setting-label" />
<ui:TextField name="unity-port" readonly="true" class="port-field" />
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:Label text="Server Port:" class="setting-label" />
<ui:TextField name="server-port" readonly="true" class="port-field" />
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:VisualElement class="status-container">
<ui:VisualElement name="status-indicator" class="status-dot" />
<ui:Label name="connection-status" text="Disconnected" class="status-text" />
</ui:VisualElement>
<ui:Button name="connection-toggle" text="Start" class="action-button" />
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:Label text="Health:" class="setting-label" />
<ui:VisualElement class="status-container">
<ui:VisualElement name="health-indicator" class="status-dot" />
<ui:Label name="health-status" text="Unknown" class="status-text" />
</ui:VisualElement>
<ui:Button name="test-connection-button" text="Test" class="action-button" />
</ui:VisualElement>
<!-- Server Status Banner -->
<ui:VisualElement name="server-status-banner" class="banner" style="display: none; background-color: rgba(255, 193, 7, 0.2); padding: 8px; margin: 8px 0; border-radius: 4px; border-left-width: 3px; border-left-color: rgb(255, 193, 7);">
<ui:Label name="server-status-message" text="" style="-unity-text-align: middle-left; white-space: normal;" />
</ui:VisualElement>
<!-- Server Management Buttons -->
<ui:VisualElement class="button-row" style="flex-direction: row; margin-top: 8px;">
<ui:Button name="download-server-button" text="Download &amp; Install Server" class="secondary-button" style="display: none; flex: 1;" />
<ui:Button name="rebuild-server-button" text="Rebuild Server" class="secondary-button" style="flex: 1;" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
<!-- Client Configuration Section -->
<ui:VisualElement name="client-section" class="section">
<ui:Label text="Client Configuration" class="section-title" />
<ui:VisualElement class="section-content">
<ui:VisualElement class="setting-row">
<ui:Label text="Client:" class="setting-label" />
<ui:DropdownField name="client-dropdown" class="setting-dropdown-inline" />
</ui:VisualElement>
<ui:Button name="configure-all-button" text="Configure All Detected Clients" class="secondary-button" />
<ui:VisualElement class="setting-row">
<ui:VisualElement class="status-container">
<ui:VisualElement name="client-status-indicator" class="status-dot" />
<ui:Label name="client-status" text="Not Configured" class="status-text" />
</ui:VisualElement>
<ui:Button name="configure-button" text="Configure" class="action-button" />
</ui:VisualElement>
<ui:VisualElement class="setting-row" name="claude-cli-path-row" style="display: none;">
<ui:Label text="Claude CLI Path:" class="setting-label-small" />
<ui:TextField name="claude-cli-path" readonly="true" class="path-display-field" />
<ui:Button name="browse-claude-button" text="Browse" class="icon-button" />
</ui:VisualElement>
<!-- Manual Configuration (Collapsible) -->
<ui:Foldout name="manual-config-foldout" text="Manual Configuration" class="manual-config-foldout">
<ui:VisualElement class="manual-config-content">
<ui:Label text="Config Path:" class="config-label" />
<ui:VisualElement class="path-row">
<ui:TextField name="config-path" readonly="true" class="config-path-field" />
<ui:Button name="copy-path-button" text="Copy" class="icon-button" />
<ui:Button name="open-file-button" text="Open" class="icon-button" />
</ui:VisualElement>
<ui:Label text="Configuration:" class="config-label" />
<ui:VisualElement class="config-json-row">
<ui:TextField name="config-json" readonly="true" multiline="true" class="config-json-field" />
<ui:Button name="copy-json-button" text="Copy" class="icon-button-vertical" />
</ui:VisualElement>
<ui:Label text="Installation Steps:" class="config-label" />
<ui:Label name="installation-steps" class="installation-steps" />
</ui:VisualElement>
</ui:Foldout>
</ui:VisualElement>
</ui:VisualElement>
</ui:ScrollView>
</ui:UXML>