Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,20 @@ private static Texture2D CaptureCompositedAfterFrame(int superSize, int timeoutS
result = tex;
done = true;
});
for (int i = 0; i < timeoutSteps && !done; i++)
// Step() pauses play mode as a side effect; restore the prior state so a screenshot
// doesn't leave a running game paused (an already-paused game stays paused).
bool wasPaused = UnityEditor.EditorApplication.isPaused;
try
{
for (int i = 0; i < timeoutSteps && !done; i++)
{
UnityEditor.EditorApplication.Step();
}
}
finally
{
UnityEditor.EditorApplication.Step();
if (!wasPaused)
UnityEditor.EditorApplication.isPaused = false;
}
callerReturned = true;
return result;
Expand Down
Loading