File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
UnityMcpBridge/Editor/Helpers Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public static int GetPortWithFallback()
3838 var storedConfig = GetStoredPortConfig ( ) ;
3939 if ( storedConfig != null &&
4040 storedConfig . unity_port > 0 &&
41- storedConfig . project_path == Application . dataPath &&
41+ string . Equals ( storedConfig . project_path ?? string . Empty , Application . dataPath ?? string . Empty , StringComparison . OrdinalIgnoreCase ) &&
4242 IsPortAvailable ( storedConfig . unity_port ) )
4343 {
4444 Debug . Log ( $ "Using stored port { storedConfig . unity_port } for current project") ;
@@ -196,7 +196,11 @@ private static void SavePort(int port)
196196
197197 string registryFile = GetRegistryFilePath ( ) ;
198198 string json = JsonConvert . SerializeObject ( portConfig , Formatting . Indented ) ;
199+ // Write to hashed, project-scoped file
199200 File . WriteAllText ( registryFile , json ) ;
201+ // Also write to legacy stable filename to avoid hash/case drift across reloads
202+ string legacy = Path . Combine ( GetRegistryDirectory ( ) , RegistryFileName ) ;
203+ File . WriteAllText ( legacy , json ) ;
200204
201205 Debug . Log ( $ "Saved port { port } to storage") ;
202206 }
You can’t perform that action at this time.
0 commit comments