From 98796264ef102655aee053260502799696355a12 Mon Sep 17 00:00:00 2001 From: David Sarno Date: Wed, 14 Jan 2026 23:09:55 -0800 Subject: [PATCH] Remove unnecessary allowNudge guard from PR #558 The allowNudge parameter was attempting to fix Unity 6 compilation loops by skipping QueuePlayerLoopUpdate, but this was not the root cause. The actual issue (fixed by #559's Unity 6+ preprocessor guard) is that EditorApplication.update callbacks don't survive domain reloads properly in Unity 6+. Since #559 skips WaitForUnityReadyAsync entirely on Unity 6+ when compile is requested, the allowNudge guard is redundant and can be removed. Co-Authored-By: Claude Sonnet 4.5 --- MCPForUnity/Editor/Tools/RefreshUnity.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MCPForUnity/Editor/Tools/RefreshUnity.cs b/MCPForUnity/Editor/Tools/RefreshUnity.cs index 2059d84..ad56be6 100644 --- a/MCPForUnity/Editor/Tools/RefreshUnity.cs +++ b/MCPForUnity/Editor/Tools/RefreshUnity.cs @@ -105,8 +105,7 @@ namespace MCPForUnity.Editor.Tools try { await WaitForUnityReadyAsync( - TimeSpan.FromSeconds(DefaultWaitTimeoutSeconds), - allowNudge: !compileRequested).ConfigureAwait(true); + TimeSpan.FromSeconds(DefaultWaitTimeoutSeconds)).ConfigureAwait(true); } catch (TimeoutException) { @@ -138,7 +137,7 @@ namespace MCPForUnity.Editor.Tools }); } - private static Task WaitForUnityReadyAsync(TimeSpan timeout, bool allowNudge) + private static Task WaitForUnityReadyAsync(TimeSpan timeout) { var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var start = DateTime.UtcNow; @@ -177,11 +176,8 @@ namespace MCPForUnity.Editor.Tools } EditorApplication.update += Tick; - if (allowNudge) - { - // Nudge Unity to pump once in case update is throttled. - try { EditorApplication.QueuePlayerLoopUpdate(); } catch { } - } + // Nudge Unity to pump once in case update is throttled. + try { EditorApplication.QueuePlayerLoopUpdate(); } catch { } return tcs.Task; } }