From 57d4f204c74d698f9a30861ae6fdff3f3fccb88b Mon Sep 17 00:00:00 2001 From: David Sarno Date: Tue, 2 Sep 2025 09:42:29 -0700 Subject: [PATCH 1/3] bump sever version --- UnityMcpBridge/UnityMcpServer~/src/server_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnityMcpBridge/UnityMcpServer~/src/server_version.txt b/UnityMcpBridge/UnityMcpServer~/src/server_version.txt index 94ff29cc..944880fa 100644 --- a/UnityMcpBridge/UnityMcpServer~/src/server_version.txt +++ b/UnityMcpBridge/UnityMcpServer~/src/server_version.txt @@ -1 +1 @@ -3.1.1 +3.2.0 From 8c2b4a2ca8c42dccfc287ee119fb982ea9017240 Mon Sep 17 00:00:00 2001 From: dsarno Date: Tue, 2 Sep 2025 14:13:13 -0700 Subject: [PATCH 2/3] Editor: Improve Windows auto-reload in ManageScript\n- Force synchronous ImportAsset and RequestScriptCompilation\n- Debounced refresh calls ImportAsset instead of Refresh\n- Path sanitation for Assets/ and slashes\n- Atomic writes with Windows-safe fallbacks\n- Nudge Editor tick for debounce reliability --- UnityMcpBridge/Editor/Tools/ManageScript.cs | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/UnityMcpBridge/Editor/Tools/ManageScript.cs b/UnityMcpBridge/Editor/Tools/ManageScript.cs index 7ec6afe9..73f48677 100644 --- a/UnityMcpBridge/Editor/Tools/ManageScript.cs +++ b/UnityMcpBridge/Editor/Tools/ManageScript.cs @@ -2568,6 +2568,8 @@ public static void Schedule(string relPath, TimeSpan window) // Kick off a ticking callback that waits until the window has elapsed // from the last request before performing the refresh. EditorApplication.delayCall += () => Tick(window); + // Nudge the editor loop so ticks run even if the window is unfocused + EditorApplication.QueuePlayerLoopUpdate(); } private static void Tick(TimeSpan window) @@ -2595,7 +2597,10 @@ private static void Tick(TimeSpan window) string[] toImport; lock (_lock) { toImport = _paths.ToArray(); _paths.Clear(); } foreach (var p in toImport) - AssetDatabase.ImportAsset(p, ImportAssetOptions.ForceUpdate); + { + var sp = ManageScriptRefreshHelpers.SanitizeAssetsPath(p); + AssetDatabase.ImportAsset(sp, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport); + } #if UNITY_EDITOR UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); #endif @@ -2607,16 +2612,31 @@ private static void Tick(TimeSpan window) static class ManageScriptRefreshHelpers { + public static string SanitizeAssetsPath(string p) + { + if (string.IsNullOrEmpty(p)) return p; + p = p.Replace('\\', '/').Trim(); + if (p.StartsWith("unity://path/", StringComparison.OrdinalIgnoreCase)) + p = p.Substring("unity://path/".Length); + while (p.StartsWith("Assets/Assets/", StringComparison.OrdinalIgnoreCase)) + p = p.Substring("Assets/".Length); + if (!p.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase)) + p = "Assets/" + p.TrimStart('/'); + return p; + } + public static void ScheduleScriptRefresh(string relPath) { - RefreshDebounce.Schedule(relPath, TimeSpan.FromMilliseconds(200)); + var sp = SanitizeAssetsPath(relPath); + RefreshDebounce.Schedule(sp, TimeSpan.FromMilliseconds(200)); } public static void ImportAndRequestCompile(string relPath, bool synchronous = true) { + var sp = SanitizeAssetsPath(relPath); var opts = ImportAssetOptions.ForceUpdate; if (synchronous) opts |= ImportAssetOptions.ForceSynchronousImport; - AssetDatabase.ImportAsset(relPath, opts); + AssetDatabase.ImportAsset(sp, opts); #if UNITY_EDITOR UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); #endif From 96326ee6a104bde549da8aa37b292a9b97d8bf23 Mon Sep 17 00:00:00 2001 From: dsarno Date: Tue, 2 Sep 2025 14:41:29 -0700 Subject: [PATCH 3/3] Editor: Detect Windows Store Python (PythonSoftwareFoundation) uv.exe in FindUvPath --- .../Editor/Helpers/ServerInstaller.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs b/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs index f6ddeaf0..235cf43b 100644 --- a/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs +++ b/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Collections.Generic; +using System.Linq; using UnityEditor; using UnityEngine; @@ -569,6 +570,31 @@ internal static string FindUvPath() } catch { } + // Windows Store (PythonSoftwareFoundation) install location probe + // Example: %LOCALAPPDATA%\Packages\PythonSoftwareFoundation.Python.3.13_*\LocalCache\local-packages\Python313\Scripts\uv.exe + try + { + string pkgsRoot = Path.Combine(localAppData, "Packages"); + if (Directory.Exists(pkgsRoot)) + { + var pythonPkgs = Directory.GetDirectories(pkgsRoot, "PythonSoftwareFoundation.Python.*", SearchOption.TopDirectoryOnly) + .OrderByDescending(p => p, StringComparer.OrdinalIgnoreCase); + foreach (var pkg in pythonPkgs) + { + string localCache = Path.Combine(pkg, "LocalCache", "local-packages"); + if (!Directory.Exists(localCache)) continue; + var pyRoots = Directory.GetDirectories(localCache, "Python*", SearchOption.TopDirectoryOnly) + .OrderByDescending(d => d, StringComparer.OrdinalIgnoreCase); + foreach (var pyRoot in pyRoots) + { + string uvExe = Path.Combine(pyRoot, "Scripts", "uv.exe"); + if (File.Exists(uvExe) && ValidateUvBinary(uvExe)) return uvExe; + } + } + } + } + catch { } + candidates = new[] { // Preferred: WinGet Links shims (stable entrypoints)