Unity
Pure C# 6 SDK compiled with Unity and supported by all Unity platforms.
On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your application.
If you don't already have an account and Sentry project established, head over to sentry.io, then return to this page.
Install
Sentry captures data by using an SDK within your application’s runtime.
Get the SDK via the Unity Package Manager using a Git URL to Sentry's SDK repository:
https://github.com/getsentry/sentry-unity-lite.git#1.0.2
Configure
Configuration should happen as early as possible in your application's lifecycle.
You can attach Sentry to a Game Object and initialize it with the DSN programatically:
var sentry = gameObject.AddComponent<SentrySdk>();
sentry.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
Verify
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up:
Once the SDK is configured with the DSN, you can call from anywhere:
SentrySdk.CaptureMessage("Test event");
Learn more about manually capturing an error or message, in our Usage documentation.
To view and resolve the recorded error, log into sentry.io and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.