Skip to content

Commit 5759201

Browse files
committed
fix(bridge): prefer persisted project port at start to avoid initial 6400 blip after UPM import
1 parent 5c632f0 commit 5759201

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

UnityMcpBridge/Editor/UnityMcpBridge.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,11 @@ public static void Start()
141141

142142
Stop();
143143

144-
// Attempt fast bind with same-port preference
144+
// Attempt fast bind with stored-port preference (sticky per-project)
145145
try
146146
{
147-
currentUnityPort = currentUnityPort > 0 && PortManager.IsPortAvailable(currentUnityPort)
148-
? currentUnityPort
149-
: PortManager.GetPortWithFallback();
147+
// Always consult PortManager first so we prefer the persisted project port
148+
currentUnityPort = PortManager.GetPortWithFallback();
150149

151150
const int maxImmediateRetries = 3;
152151
const int retrySleepMs = 75;

0 commit comments

Comments
 (0)