---
title: "Troubleshooting"
description: "Learn more about how to troubleshoot common issues with the Unity SDK. "
url: https://docs.sentry.io/platforms/unity/troubleshooting/
---

# Troubleshooting for Unity

## [Build Issues](https://docs.sentry.io/platforms/unity/troubleshooting.md#build-issues)

### [Disabling the Sentry SDK for selected platforms](https://docs.sentry.io/platforms/unity/troubleshooting.md#disabling-the-sentry-sdk-for-selected-platforms)

If you want to disable the SDK for a specific platform, you can use the [programmatic configuration](https://docs.sentry.io/platforms/unity/configuration/options/programmatic-configuration.md) to have your own code run as part of the initialization and disable the SDK like in the example below:

```csharp
using Sentry.Unity;

public class SentryOptionConfiguration : SentryOptionsConfiguration
{
    public override void Configure(SentryUnityOptions options)
    {
#if UNITY_ANDROID
        options.Enabled = false;
#endif
    }
}
```

### [Build input file cannot be found: '\*\*/Libraries/io.sentry.unity/Plugins/iOS/SentryNativeBridge.m'](https://docs.sentry.io/platforms/unity/troubleshooting.md#build-input-file-cannot-be-found-librariesiosentryunitypluginsiossentrynativebridgem)

You can resolve this issue by creating a clean build or choosing "Replace" when prompted. Alternatively, you can remove the unused `SentryNativeBridge.m`from the **UnityFramework Target > Compile Sources** in the project settings. Instead of relying on Unity to copy the `SentryNativeBridge.m` over to the generated Xcode project, starting with 0.12.0, the SDK copies it manually to `**/Libraries/io.sentry.unity/SentryNativeBridge.m`.

### [Failed to locate the Sentry package](https://docs.sentry.io/platforms/unity/troubleshooting.md#failed-to-locate-the-sentry-package)

This happens if you've copied some of the SDK files directly to the Assets folder. You can resolve this issue by installing the SDK with UPM.

## [Debug Symbol Upload](https://docs.sentry.io/platforms/unity/troubleshooting.md#debug-symbol-upload)

If stack traces in Sentry are missing function names or line numbers, check the output of the debug symbol upload. The [Debug Symbols table](https://docs.sentry.io/platforms/unity/native-support.md#debug-symbols) lists where the upload runs on each platform and where to find its log.

If the upload doesn't run at all, check that:

* Sentry is enabled and the DSN is set. Desktop and console builds skip the upload otherwise, and Android builds skip it if Sentry is disabled.
* **Upload Symbols** is enabled on the **Debug Symbols** tab in **Tools > Sentry**.
* The **Auth Token** and **Project Name** are set.
* For development builds, **Upload Dev Symbols** is enabled.

If the upload runs but fails, check that the **Org Slug** is set, unless the auth token is an organization token.

If you enable **Ignore CLI Errors**, the SDK passes `--allow-failure` to `sentry-cli`, so upload errors don't fail the build. Check the log to make sure the upload worked. On iOS, `sentry-symbols-upload.log` then only contains what `sentry-cli` writes to stderr, and the rest of the upload output is in the Xcode build output, so check both.

## [Runtime issues](https://docs.sentry.io/platforms/unity/troubleshooting.md#runtime-issues)

### [Android: Initialization fails - APK+OBB](https://docs.sentry.io/platforms/unity/troubleshooting.md#android-initialization-fails---apkobb)

When exporting your Unity project as APK+OBB, the `ScriptableSentryOptions` configuration file stored in `/Resources/Sentry` may end up in the OBB file instead of the main APK. This can cause initialization issues if the OBB file is not available when the SDK attempts to auto-initialize.

**Workaround (requires Unity SDK version `4.0.0 or later`):**

Instead of relying on the ScriptableObject configuration and auto-initialization, you can manually initialize the SDK from your code:

```csharp
using Sentry.Unity;
using UnityEngine;

public class GameInitializer : MonoBehaviour
{
    private void Start()
    {
        SentrySdk.Init(options =>
        {
            options.Dsn = "https://<key>@o<orgId>.ingest.sentry.io/<projectId>";
            options.Debug = true;
            // Add other configuration options as needed
        });
    }
}
```

Since this way the options are embedded in code, the reliance on the `/Resources` being available at the time of initialization falls away. Unlike regular [manual initialization](https://docs.sentry.io/platforms/unity/configuration/options/programmatic-configuration.md#manual-initialization), keep **Enable Sentry** checked in the editor window: the SDK can't load its options from the OBB, so your `SentrySdk.Init` call is the only one, and the build still sets up native support.

### [Library not loaded: @rpath/SentryObjC.framework/SentryObjC](https://docs.sentry.io/platforms/unity/troubleshooting.md#library-not-loaded-rpathsentryobjcframeworksentryobjc)

If you encounter the following error:

```bash
2021-10-29 15:21:40.011452-0400 MyApp[2180:186329] Error loading /var/containers/Bundle/Application/88CC4619-7C5D-4BB1-9F4B-5AAD7EC4BF9C/MyApp.app/Frameworks/UnityFramework.framework/UnityFramework:  dlopen(/var/containers/Bundle/Application/88CC4619-7C5D-4BB1-9F4B-5AAD7EC4BF9C/MyApp.app/Frameworks/UnityFramework.framework/UnityFramework, 265): Library not loaded: @rpath/SentryObjC.framework/SentryObjC
  Referenced from: /private/var/containers/Bundle/Application/88CC4619-7C5D-4BB1-9F4B-5AAD7EC4BF9C/MyApp.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: image not found
```

This can happen if you've copied some of the SDK files directly to the Assets folder and the `Sentry.Unity.Editor.iOS.dll` which runs when you build an iOS player wasn't able to copy the `SentryObjC.xcframework` to the final app. Enabling debug mode in the Sentry editor window would display more information in the Unity console.

You can resolve this issue by installing the SDK with UPM.

## [Events](https://docs.sentry.io/platforms/unity/troubleshooting.md#events)

### [Universal Windows Platform - Events Not Sent](https://docs.sentry.io/platforms/unity/troubleshooting.md#universal-windows-platform---events-not-sent)

In order to send events to Sentry, you will need to activate the InternetClient Capability in your Player Settings.

### [Mono JIT stack trace is incomplete on crashes](https://docs.sentry.io/platforms/unity/troubleshooting.md#mono-jit-stack-trace-is-incomplete-on-crashes)

This is a [known limitation](https://github.com/getsentry/sentry-unity/issues/884#issuecomment-1233035296) of the Mono JIT scripting backend, resulting from the native code not being able to see the actual generated code at the time of a crash. There are no debug files we can use to provide more information to stack traces since all code is generated when running the managed code. Using the IL2CPP scripting backend may provide more information, if that's an option for you.

### [Sentry didn't capture Unity's test/helper function ForceCrash](https://docs.sentry.io/platforms/unity/troubleshooting.md#sentry-didnt-capture-unitys-testhelper-function-forcecrash)

Unity provides a function to test crashes called `UnityEngine.Diagnostics.Utils.ForceCrash()`. The Sentry SDK subscribes to the signal handlers and captures **all signals** received by it. But the result of that function doesn't get invoked our callback. Outside of this helper function, Sentry is unaware of any **real world** crash type that isn't invoking our signal handlers.

### [Screenshot contain artifacts](https://docs.sentry.io/platforms/unity/troubleshooting.md#screenshot-contain-artifacts)

The screenshot capture relies on Unity's `ScreenCapture.CaptureScreenshotIntoRenderTexture` function. In the Editor, the SDK only takes screenshots for user feedback, and these can contain artifacts or scaling issues.

## Pages in this section

- [Known Limitations](https://docs.sentry.io/platforms/unity/troubleshooting/known-limitations.md)

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
