Sentry Integration
Sentry integration
The AIT SDK Sentry Unity SDKand supports automatic integration. If Sentry is installed, it automatically injects AIT platform context (device ID, environment, deployment ID, etc.) into crash and error events.
Zero-cost opt-in: If the Sentry SDK is not installed in the project, the related code is not compiled at all. There is no runtime overhead and no compile errors.
Installation
Method 1: Unity menu (recommended)
In the Unity Editor,
AIT>Install Sentry SDKclick.The Package Manager automatically installs Sentry Unity SDK 4.1.0.
Method 2: Add manifest.json directly
Packages/manifest.jsoncan be added directly:
{
"dependencies": {
"io.sentry.unity": "https://github.com/getsentry/unity.git#4.1.0"
}
}Supported versions
Minimum:
io.sentry.unity4.0.0Recommended: 4.1.0 or later
Configuration
Only the Sentry SDK itself needs to be configured. AIT integration works automatically without separate setup.
DSN setup
In the Unity Editor, Tools > Sentryopen DSNand enter it.
The DSN is in your Sentry project’s Settings > Client Keys (DSN)You can check it in. The setting is saved in Assets/Resources/Sentry/SentryOptions.asset.
Automatically injected AIT context
When the Sentry SDK is active, the AIT SDK automatically injects the following context.
Tags
ait.sdk_version
AIT SDK version
1.11.2
ait.unity_version
Unity engine version
6000.3.3f1
ait.device_id
Unique device ID
abc123...
ait.platform_os
Platform OS
iOS, Android
ait.locale
Device locale
ko-KR
ait.toss_app_version
Toss app version
5.80.0
ait.environment
Production environment
production, staging
ait.deployment_id
Deployment ID
deploy-xyz
ait.current_scene
Current Unity scene
MainMenu
User
User.Id
AIT device ID (AIT.GetDeviceId())
Context Object
apps_in_toss A custom context object named is added:
Breadcrumbs
A breadcrumb is automatically recorded every time a Unity scene is loaded:
message
Scene loaded: MainMenu
category
scene
level
Info
data
scene_name, scene_build_index, load_mode
CI/CD environment variables
Sentry SDK core (build-time auto injection)
When building WebGL, the AIT SDK SENTRY_DSN from the environment variable SentryOptions.assetis automatically generated.
SENTRY_DSN
DSN → SentryOptions.asset Auto-generated
https://key@sentry.io/123
SENTRY_ENVIRONMENT
Environment identifier (auto-injected)
production, staging
SENTRY_RELEASE
Release version (auto-injected)
my-app@1.0.0
sentry-cli (build time)
Used when uploading debug symbols and sourcemaps. Configure it in the CI/CD pipeline.
SENTRY_AUTH_TOKEN
API auth token
sntrys_...
SENTRY_ORG
Organization slug
my-org
SENTRY_PROJECT
Project slug
unity-game
Example CI/CD pipeline
How it works
Conditional compilation
The Sentry integration uses Unity's versionDefinesto implement conditional compilation:
io.sentry.unityWhen 4.0.0 or later is installed,AIT_SENTRY_AVAILABLEthe define is automatically enabled.AppsInToss.Sentryassembly'sdefineConstraintstoAIT_SENTRY_AVAILABLEare set.If the Sentry SDK is not installed, the entire assembly is excluded from compilation.
IL2CPP stripping protection
Triple protection is applied so code is not stripped from WebGL (IL2CPP) builds:
[assembly: AlwaysLinkAssembly]
Prevents the assembly itself from being removed by the linker
[Preserve]
Preserves individual types/methods
link.xml
Declares preservation of all types in the assembly
Unity 6+ IL2CPP stack traces
In Unity 6 and later, C# file/line information is automatically enabled in IL2CPP stack traces for WebGL builds. This lets you pinpoint crash locations in Sentry down to the exact source code line.
Troubleshooting
Last updated
Was this helpful?