Skip to content

fix: Screenshot Capture #2240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

fix: Screenshot Capture #2240

wants to merge 21 commits into from

Conversation

bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Jul 10, 2025

Fixes #2224, #1827 🎉
Relies on the .NET SDK getsentry/sentry-dotnet#4357

Context

The SDK has to wait for EndOfFrame before capturing a screenshot as the behaviour is unreliable otherwise. See Unity docs.

Implementation

The ScreenshotProcessor uses the SentryMonoBehaviour to start a coroutine that waits for End of Frame to capture the screenshot. The screenshot gets sent as an envelop with a single attachment as envelope item.


public void CaptureScreenshotForEvent(SentryUnityOptions options, SentryId eventId)
{
StartCoroutine(CaptureScreenshot(options, eventId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method returns before the coroutine starts/ends, right? how do we know the screenshot will be taken before the event is created?

Copy link
Contributor Author

@bitsandfoxes bitsandfoxes Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ScreenshotProcessor forwards the call to the SentryMonoBehaviour that starts the coroutine for the current EndOfFrame.

@bitsandfoxes bitsandfoxes force-pushed the fix/screenshot-capture branch from 276efc3 to 11548fe Compare July 18, 2025 14:25
@bitsandfoxes bitsandfoxes marked this pull request as ready for review July 18, 2025 15:17
@bruno-garcia
Copy link
Member

CI is unhappy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attached screenshots blank
3 participants