fix(bridge): prefer persisted project port at start to avoid initial 6400 blip after UPM import

main
David Sarno 2025-08-08 08:18:33 -07:00
parent 5c632f0ab3
commit 57592017ae
1 changed files with 3 additions and 4 deletions

View File

@ -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;