For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  1. In the Unity Editor, AIT > Install Sentry SDKclick.

  2. The Package Manager automatically installs Sentry Unity SDK 4.1.0.

If the Sentry SDK is already installed, the menu is disabled.

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.unity 4.0.0

  • Recommended: 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

Tag
Description
Example

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

Field
Value

User.Id

AIT device ID (AIT.GetDeviceId())

Context Object

apps_in_toss A custom context object named is added:

A breadcrumb is automatically recorded every time a Unity scene is loaded:

Field
Value

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.

Variable
Purpose
Example

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.

Variable
Purpose
Example

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:

  1. io.sentry.unity When 4.0.0 or later is installed, AIT_SENTRY_AVAILABLE the define is automatically enabled.

  2. AppsInToss.Sentry assembly's defineConstraintsto AIT_SENTRY_AVAILABLEare set.

  3. 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:

Protection method
Role

[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

Sentry events are not being sent
  1. Tools > SentryPlease make sure the DSN is configured correctly.

  2. In the console, [AIT:Sentry] Sentry is not enabled if you see this message, the Sentry SDK is disabled.

  3. For WebGL CI/CD, SENTRY_DSN if you set the environment variables, at build time SentryOptions.assetit is automatically generated.

AIT tags are missing in IL2CPP builds

The integration code may have been removed by IL2CPP stripping.

  1. Assets/link.xmlPlease make sure it includes the following:

  1. Library/Bee/artifacts/WebGL/ Delete the folder and run a clean build.

Some AIT context values are shown as `unavailable`

This means an AIT platform API call failed. Each API fails independently, and the remaining context is injected normally.

  • Some APIs may not be supported in the mock bridge environment.

  • In case of a network timeout, without retry unavailableis set to.

Last updated

Was this helpful?