You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MCPForUnity/Editor/Helpers/PortManager.cs
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -60,14 +60,17 @@ public static int GetPortWithFallback()
60
60
if(IsDebugEnabled())Debug.Log($"<b><color=#2EA3FF>MCP-FOR-UNITY</color></b>: Stored port {storedConfig.unity_port} became available after short wait");
61
61
returnstoredConfig.unity_port;
62
62
}
63
-
// Prefer sticking to the same port; let the caller handle bind retries/fallbacks
64
-
returnstoredConfig.unity_port;
63
+
// Port is still busy after waiting - find a new available port instead
64
+
if(IsDebugEnabled())Debug.Log($"<b><color=#2EA3FF>MCP-FOR-UNITY</color></b>: Stored port {storedConfig.unity_port} is occupied by another instance, finding alternative...");
65
+
intnewPort=FindAvailablePort();
66
+
SavePort(newPort);
67
+
returnnewPort;
65
68
}
66
69
67
70
// If no valid stored port, find a new one and save it
0 commit comments