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 <noreply@anthropic.com>main
parent
87d0f1d422
commit
98796264ef
|
|
@ -105,8 +105,7 @@ namespace MCPForUnity.Editor.Tools
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await WaitForUnityReadyAsync(
|
await WaitForUnityReadyAsync(
|
||||||
TimeSpan.FromSeconds(DefaultWaitTimeoutSeconds),
|
TimeSpan.FromSeconds(DefaultWaitTimeoutSeconds)).ConfigureAwait(true);
|
||||||
allowNudge: !compileRequested).ConfigureAwait(true);
|
|
||||||
}
|
}
|
||||||
catch (TimeoutException)
|
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<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
var start = DateTime.UtcNow;
|
var start = DateTime.UtcNow;
|
||||||
|
|
@ -177,11 +176,8 @@ namespace MCPForUnity.Editor.Tools
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorApplication.update += Tick;
|
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;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue