Releases & Health for Unity
Learn how to configure your Sentry Unity SDK to tell Sentry about your releases.
The Crash Free Session Rate requires native support. On platforms that don't yet have native support, the SDK reports sessions that did not end gracefully as Abnormal, which leads to 100% crash free sessions being recorded. If you're building on a platform that doesn't have native support yet, you should monitor your app's Abnormal rate.
A release is a version of your code that is deployed to an environment. When you give Sentry information about your releases, you can:
- Determine issues and regressions introduced in a new release
- Predict which commit caused an issue and who is likely responsible
- Resolve issues by including the issue number in your commit message
- Receive email notifications when your code gets deployed
Include a release ID (often called a "version") when you initialize the SDK.
There are some release name restrictions and conventions to be aware of. Learn more about naming releases.
Releases can also be auto-created by different systems—for example, when uploading a source map, or by some clients when an event that is tagged with a release is ingested. Therefore, it's important to set the release name when building and deploying your application. Learn more in our Releases documentation.
using Sentry.Unity;
SentrySdk.Init(o =>
{
o.Release = "my-project-name@2.3.12";
});
using Sentry.Unity;
SentrySdk.Init(o =>
{
o.Release = "my-project-name@2.3.12";
});
By default the SDK will read from Application.productName and Application.version to create the release in the format $"{Application.productName}@{Application.version}".
How you make the release name (or version) available to your code is up to you. For example, you could use an environment variable that is set during the build process or during initial start-up.
Setting the release name tags each event with that release name. We recommend that you tell Sentry about a new release before sending events with that release name, as this will unlock a few more features. Learn more in our Releases documentation.
If you don't tell Sentry about a new release, Sentry will automatically create a release entity in the system the first time it sees an event with that release ID.
After configuring your SDK, you can install a repository integration or manually supply Sentry with your own commit metadata. Read our documentation about setting up releases for further information about integrations, associating commits, and telling Sentry when deploying releases.
Monitor the health of releases by observing user adoption, usage of the application, percentage of crashes, and session data. Release health will provide insight into the impact of crashes and bugs as it relates to user experience, and reveal trends with each new issue through the Release Details graphs and filters.
In order to monitor release health, the SDK sends session data.
A session represents the interaction between the user and the application. Sessions contain a timestamp, a status (if the session was OK or if it crashed), and are always linked to a release. Most Sentry SDKs can manage sessions automatically.
The SDK tracks sessions by default. It marks each session as:
- Healthy
- Abnormal
- Errored: if the SDK captures a handled exception, for example through
SentrySdk.CaptureException. - Unhandled: if the SDK captures an uncaught exception or a
Debug.LogExceptioncall, and the game keeps running. - Crashed
The SDK starts a session when the game starts. When the game quits, the SDK pauses the session and closes it at the next start. This way, the SDK can tell whether the previous run crashed. Closing the paused session and detecting the crash need a CacheDirectoryPath, so they don't work when offline caching is off, or on Xbox, where the SDK doesn't set one. On Nintendo Switch, the SDK doesn't track sessions.
The SDK pauses the session when the game loses focus or goes into the background. If the game comes back within AutoSessionTrackingInterval, the session continues. Otherwise, the SDK ends it and starts a new one. The default is 30 seconds. In the editor, these settings are under Auto Session Tracking in Tools > Sentry > Advanced, where Timeout [ms] sets the interval.
// Add this to the SDK initialization callback
options.AutoSessionTrackingInterval = TimeSpan.FromSeconds(30);
// Add this to the SDK initialization callback
options.AutoSessionTrackingInterval = TimeSpan.FromSeconds(30);
To turn off session tracking:
// Add this to the SDK initialization callback
options.AutoSessionTracking = false;
// Add this to the SDK initialization callback
options.AutoSessionTracking = false;
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").