Skip to content

Commit d8f4cd9

Browse files
committed
docs(screenshot): trim inline CaptureComposited comment, collapse branch to ternary
The 4-line inline comment in CaptureComposited duplicated CaptureCompositedAfterFrame's own header and exceeded the 1-2 line guidance. Trim to 2 lines and collapse the play-mode / edit-mode branch to a ternary (matches the file's existing style).
1 parent 48fbad4 commit d8f4cd9

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,18 +296,11 @@ public static ScreenshotCaptureResult CaptureComposited(
296296
try
297297
{
298298
#if UNITY_EDITOR
299-
// In the editor, ScreenCapture.CaptureScreenshotAsTexture called inline reads a
300-
// backbuffer that has not yet been presented (UITK overlays are composited at
301-
// end-of-frame). Route through a WaitForEndOfFrame coroutine + EditorApplication
302-
// .Step() spin so the captured texture actually contains the composited frame.
303-
if (Application.isPlaying)
304-
{
305-
tex = CaptureCompositedAfterFrame(result.SuperSize);
306-
}
307-
else
308-
{
309-
tex = ScreenCapture.CaptureScreenshotAsTexture(result.SuperSize);
310-
}
299+
// In play mode, inline ScreenCapture reads a backbuffer before UITK has
300+
// composited; route through WaitForEndOfFrame instead.
301+
tex = Application.isPlaying
302+
? CaptureCompositedAfterFrame(result.SuperSize)
303+
: ScreenCapture.CaptureScreenshotAsTexture(result.SuperSize);
311304
#else
312305
tex = ScreenCapture.CaptureScreenshotAsTexture(result.SuperSize);
313306
#endif

0 commit comments

Comments
 (0)