44using MCPForUnity . Editor . Helpers ;
55using MCPForUnity . Editor . Services ;
66using MCPForUnity . Editor . Windows . Components . ClientConfig ;
7- using MCPForUnity . Editor . Windows . Components . Connection ;
87using MCPForUnity . Editor . Windows . Components . Settings ;
98using UnityEditor ;
109using UnityEngine ;
@@ -16,7 +15,6 @@ public class MCPForUnityEditorWindow : EditorWindow
1615 {
1716 // Section controllers
1817 private McpSettingsSection settingsSection ;
19- private McpConnectionSection connectionSection ;
2018
2119 private static readonly HashSet < MCPForUnityEditorWindow > OpenWindows = new ( ) ;
2220 private bool guiCreated = false ;
@@ -116,17 +114,6 @@ public void CreateGUI()
116114 settingsSection = new McpSettingsSection ( settingsRoot ) ;
117115 }
118116
119- // Load and initialize Connection section
120- var connectionTree = AssetDatabase . LoadAssetAtPath < VisualTreeAsset > (
121- $ "{ basePath } /Editor/Windows/Components/Connection/McpConnectionSection.uxml"
122- ) ;
123- if ( connectionTree != null )
124- {
125- var connectionRoot = connectionTree . Instantiate ( ) ;
126- sectionsContainer . Add ( connectionRoot ) ;
127- connectionSection = new McpConnectionSection ( connectionRoot ) ;
128- }
129-
130117 guiCreated = true ;
131118
132119 // Initial updates
@@ -159,8 +146,6 @@ private void OnEditorUpdate()
159146 {
160147 if ( rootVisualElement == null || rootVisualElement . childCount == 0 )
161148 return ;
162-
163- connectionSection ? . UpdateConnectionStatus ( ) ;
164149 }
165150
166151 private void RefreshAllData ( )
@@ -172,43 +157,6 @@ private void RefreshAllData()
172157 return ;
173158 }
174159 lastRefreshTime = currentTime ;
175-
176- connectionSection ? . UpdateConnectionStatus ( ) ;
177-
178- if ( MCPServiceLocator . Bridge . IsRunning )
179- {
180- _ = connectionSection ? . VerifyBridgeConnectionAsync ( ) ;
181- }
182- }
183-
184- internal static void RequestHealthVerification ( )
185- {
186- foreach ( var window in OpenWindows )
187- {
188- window ? . ScheduleHealthCheck ( ) ;
189- }
190- }
191-
192- private void ScheduleHealthCheck ( )
193- {
194- EditorApplication . delayCall += async ( ) =>
195- {
196- // Ensure window and components are still valid before execution
197- if ( this == null || connectionSection == null )
198- {
199- return ;
200- }
201-
202- try
203- {
204- await connectionSection . VerifyBridgeConnectionAsync ( ) ;
205- }
206- catch ( Exception ex )
207- {
208- // Log but don't crash if verification fails during cleanup
209- McpLog . Warn ( $ "Health check verification failed: { ex . Message } ") ;
210- }
211- } ;
212160 }
213161 }
214162}
0 commit comments