From 57592017ae07c3b51baf68a87c089d903322ff32 Mon Sep 17 00:00:00 2001 From: David Sarno Date: Fri, 8 Aug 2025 08:18:33 -0700 Subject: [PATCH] fix(bridge): prefer persisted project port at start to avoid initial 6400 blip after UPM import --- UnityMcpBridge/Editor/UnityMcpBridge.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/UnityMcpBridge/Editor/UnityMcpBridge.cs b/UnityMcpBridge/Editor/UnityMcpBridge.cs index a55a7ec..a01468f 100644 --- a/UnityMcpBridge/Editor/UnityMcpBridge.cs +++ b/UnityMcpBridge/Editor/UnityMcpBridge.cs @@ -141,12 +141,11 @@ namespace UnityMcpBridge.Editor Stop(); - // Attempt fast bind with same-port preference + // Attempt fast bind with stored-port preference (sticky per-project) try { - currentUnityPort = currentUnityPort > 0 && PortManager.IsPortAvailable(currentUnityPort) - ? currentUnityPort - : PortManager.GetPortWithFallback(); + // Always consult PortManager first so we prefer the persisted project port + currentUnityPort = PortManager.GetPortWithFallback(); const int maxImmediateRetries = 3; const int retrySleepMs = 75;