---
title: "Automatic Instrumentation"
description: "Learn what transactions are captured after tracing is enabled in the Sentry Unity SDK."
url: https://docs.sentry.io/platforms/unity/tracing/instrumentation/automatic-instrumentation/
---

# Automatic Instrumentation for Unity

## [Automatically Captured Transactions](https://docs.sentry.io/platforms/unity/tracing/instrumentation/automatic-instrumentation.md#automatically-captured-transactions)

The Unity SDK can automatically instrument:

| What                                                     | Option                                                                                                                                           | Default |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| The game's startup                                       | [`AutoStartupTraces`](https://docs.sentry.io/platforms/unity/configuration/options.md#AutoStartupTraces)                                         | `true`  |
| Scene loading                                            | [`AutoSceneLoadTraces`](https://docs.sentry.io/platforms/unity/configuration/options.md#AutoSceneLoadTraces)                                     | `true`  |
| Spans for `Awake` calls during startup and scene loading | [`PerformanceAutoInstrumentationEnabled`](https://docs.sentry.io/platforms/unity/configuration/options.md#PerformanceAutoInstrumentationEnabled) | `false` |

All three need `TracesSampleRate` to be greater than `0`. The SDK doesn't create startup transactions in the editor, on WebGL, or when you initialize the SDK yourself after the first scene has loaded.

Set these options under **Auto Instrumentation** on the **Core** tab of **Tools > Sentry**, or in your [options configuration script](https://docs.sentry.io/platforms/unity/configuration/options/programmatic-configuration.md):

```csharp
public override void Configure(SentryUnityOptions options)
{
    options.PerformanceAutoInstrumentationEnabled = true;
}
```

The SDK adds the `Awake` spans when you build the game, by modifying the compiled code. It only instruments classes in `Assembly-CSharp` that inherit directly from `MonoBehaviour`. Because the SDK reads `PerformanceAutoInstrumentationEnabled` during the build, set it in the editor or in your options configuration script. Setting it in `SentrySdk.Init` has no effect.

After you've configured your instrumentation, the Unity SDK will generate traces as shown in the image below.

## [Scene Loading and `SceneManagerAPI`](https://docs.sentry.io/platforms/unity/tracing/instrumentation/automatic-instrumentation.md#scene-loading-and-scenemanagerapi)

To trace scene loading, the SDK sets `SceneManagerAPI.overrideAPI` and replaces any override you set before. If your game uses its own `SceneManagerAPI` override, set `AutoSceneLoadTraces` to `false`.
