Screenshots
When a user experiences an error, an exception or a crash, Sentry provides the ability to take a screenshot and include it as an attachment.
This feature only applies to SDKs with a user interface, such as the ones for mobile and desktop applications. In some environments like native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. Another example where a screenshot might not be available is when the event happens before the screen starts to load. So inherently, this feature is a best effort solution.
Enabling Screenshots
Screenshots may contain PII and is an opt-in feature. You can enable it as shown below:
Using the editor integrations in Tools > Sentry:
Or, like so, if you're configuring things programatically:
options.AttachScreenshot = true;
Screenshot capture mechanism
Since the Unity SDK internally consists of multiple SDKs, the mechanism with which a screenshot gets captured depends on where the error originates.
- C# errors from within your game will be captured through Unity's built-in ScreenCapture. This means that screenshots only contain things visible within your game. Overlays on top of your game will not be visible.
- Native errors get captured by their respective SDK. If you're using a native plugin to display an overlay and an error occurs then that SDK will try to capture a screenshot that contains the overlay.
Screenshots might contain PII of your app. For example, if your game has a registration form and an error happens while the form is being displayed.
Viewing Screenshots
A thumbnail of the screenshot shows up at the top of the Issue Details page:
Additionally, screenshots appear in the "Attachments" tab, where you can view all attachments, as well as associated events. Click the event ID to open the Issue Details page of that specific event.
You can see an overview of all the screenshots associated with the events in your issue by clicking "Screenshots" in the "Attachments" tab.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- upm:sentry-unity
- Version:
- 1.7.1
- Repository:
- https://github.com/getsentry/sentry-unity