Visitar URL original
docs(unity): Update screenshots, options and sampling for SDK 4.13.0 by bitsandfoxes · Pull Request #20784 · getsentry/sentry-docs · GitHub
Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions docs/platforms/unity/configuration/options/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Grouping in Sentry is different for events with stack traces and without. As a r

<SdkOption name="AttachScreenshot" type="bool" defaultValue="false">

Attaches a screenshot of the game to events, such as errors and messages, and sends it in the same envelope as the event. Screenshots aren't attached in the Editor, in batch mode, or on WebGL.
Attaches a screenshot of the game to events, such as errors and messages, and sends it in the same envelope as the event. Screenshots aren't attached in the Editor, in batch mode, or on WebGL. On iOS and Windows, native crashes also get a screenshot, taken by the native SDK.
Learn more about enriching events with screenshots in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.

</SdkOption>
Expand Down Expand Up @@ -147,6 +147,8 @@ Sets the distribution of the application. Distributions are used to disambiguate

If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent.

In Unity, it adds the device name (`device.name`) and the device's unique identifier to events. Native crashes on Windows, Linux, macOS with the Native backend, and game consoles carry the device name only with this option, too. Native crashes on iOS, Android, and macOS with the Cocoa backend don't include the device name. With <PlatformIdentifier name="IsEnvironmentUser" />, it also adds the user name. Learn more in <PlatformLink to="/data-management/data-collected/">Data Collected</PlatformLink>.

<Alert>

If you are using Sentry in your mobile app, read our [frequently asked questions about mobile data privacy](/security-legal-pii/security/mobile-privacy/) to assist with Apple App Store and Google Play app privacy details.
Expand Down Expand Up @@ -197,13 +199,13 @@ By the time <PlatformIdentifier name="SetBeforeSendTransaction" /> is executed,

<SdkOption name="SetBeforeCaptureScreenshot" type="function">

A callback function that controls screenshot capture behavior. Return `false` to prevent a screenshot from being attached to a specific event. It can run on a background thread and runs before <PlatformIdentifier name="SetBeforeSend" /> and sampling. Learn more in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.
A callback function that controls screenshot capture behavior. Return `false` to prevent a screenshot from being attached to a specific event. It can run on a background thread and runs before <PlatformIdentifier name="SetBeforeSend" /> and sampling. Setting it turns off screenshots for native crashes on iOS, as it can't run during a crash. Learn more in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.

</SdkOption>

<SdkOption name="SetBeforeSendScreenshot" type="function">

A callback function that receives the screenshot as a `Texture2D` before it gets compressed, along with the event it belongs to. Modify or replace the texture and return it, or return `null` to discard the screenshot. Setting it makes the SDK read and compress screenshots on the main thread. Learn more in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.
A callback function that receives the screenshot as a `Texture2D` before it gets compressed, along with the event it belongs to. Modify or replace the texture and return it, or return `null` to discard the screenshot. Setting it makes the SDK read and compress screenshots on the main thread, and turns off screenshots for native crashes on iOS, as it can't run during a crash. Learn more in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.

</SdkOption>

Expand Down
4 changes: 3 additions & 1 deletion docs/platforms/unity/configuration/sampling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Adding Sentry to your app gives you a great deal of very valuable information ab

## Sampling Error Events

To send a representative sample of your errors to Sentry, set the <PlatformIdentifier name="sample-rate" /> option in your SDK configuration to a number between `0` (0% of errors sent) and `1` (100% of errors sent). This is a static rate, which will apply equally to all errors. For example, to sample 25% of your errors:
To send a representative sample of your errors to Sentry, set the <PlatformIdentifier name="sample-rate" /> option in your SDK configuration to a number greater than `0` and up to `1` (100% of errors sent). In the configuration window, the **Event Sample Rate** field accepts `0.01` to `1`. This is a static rate, which will apply equally to all errors. For example, to sample 25% of your errors:

<PlatformContent includePath="configuration/sample-rate" />

The error sample rate defaults to `1`, meaning all errors are sent to Sentry.

Native crashes on Android, iOS, and macOS with the Cocoa backend follow the error sample rate too. On Windows, Linux, macOS with the Native backend, and game consoles, the native SDK always sends crashes.

<Alert>

Changing the error sample rate requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs.
Expand Down
17 changes: 11 additions & 6 deletions docs/platforms/unity/enriching-events/screenshots/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ If the screenshot can't be taken, for example because the main thread doesn't re

### Native Errors

| Platform | Screenshot for native errors and crashes |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| iOS | Captured by sentry-cocoa, only with <PlatformLink to="/native-support/#build-time-initialization">build time initialization</PlatformLink> |
| Windows | Captured by sentry-native when the game crashes |
| Android, macOS, Linux | None |
| Platform | Screenshot for native crashes |
| --------------------- | ----------------------------------------------- |
| iOS | Captured by sentry-cocoa when the game crashes |
| Windows | Captured by sentry-native when the game crashes |
| Android, macOS, Linux | None |

These screenshots are taken by the native SDK, so they include overlays, and <PlatformIdentifier name="SetBeforeCaptureScreenshot" /> and <PlatformIdentifier name="SetBeforeSendScreenshot" /> don't apply to them.
Other events the native SDKs capture, such as failed HTTP requests captured by sentry-cocoa, don't get a screenshot.

Native crash screenshots are taken by the native SDK in its crash handler, so they include overlays, and <PlatformIdentifier name="SetBeforeCaptureScreenshot" /> and <PlatformIdentifier name="SetBeforeSendScreenshot" /> can't run for them:

- On iOS, setting either callback turns native crash screenshots off, so a crash doesn't send a screenshot your callbacks would have skipped or masked. With <PlatformLink to="/native-support/#build-time-initialization">build time initialization</PlatformLink>, the native SDK's options are fixed when you build, so only callbacks set in your [options configuration script](/platforms/unity/configuration/options/programmatic-configuration/) turn them off.
- On Windows, sentry-native attaches them whether or not these callbacks are set.

<Alert>

Expand Down
Loading