-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
base: main
Are you sure you want to change the base?
fix: Screenshot Capture #2240
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Screenshot Capture ([#2240](https://github.com/getsentry/sentry-unity/pull/2240)) If none of the above apply, you can opt out of this check by adding |
{ | ||
return @event; | ||
_options = sentryOptions; | ||
_sentryMonoBehaviour = sentryMonoBehaviour ?? SentryMonoBehaviour.Instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a public ctor that passes SentryMonoBehaviour.Instance
already, having also ??
seems redundant.
Since this is an internal ctor, how about:
_sentryMonoBehaviour = sentryMonoBehaviour ?? SentryMonoBehaviour.Instance; | |
_sentryMonoBehaviour = sentryMonoBehaviour ?? throw new ArgumentNullException("sentryMonoBehaviour"); |
|
||
public void CaptureScreenshotForEvent(SentryUnityOptions options, SentryId eventId) | ||
{ | ||
StartCoroutine(CaptureScreenshot(options, eventId)); |
There was a problem hiding this comment.
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?
Fixes #2224, #1827 🎉
The SDK has to wait for the
EndOfFrame
to capture a screenshot. The behaviour is unreliable otherwise.Since we're now waiting for
EndOfFrame
we can now also make sure not to capture more than one screenshot per frame.Open Question
But that also means, that only the first error in a given frame has a screenshot attached to it?
Do we send the same screenshot multiple times, for each error?