Troubleshooting
Learn more about how to troubleshoot common issues with the Unity SDK.
If you want to disable the SDK for a specific platform, you can use the programmatic configuration to have your own code run as part of the initialization and disable the SDK like in the example below:
using Sentry.Unity;
public class SentryOptionConfiguration : SentryOptionsConfiguration
{
public override void Configure(SentryUnityOptions options)
{
#if UNITY_ANDROID
options.Enabled = false;
#endif
}
}
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
.
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.
If you encounter the following error:
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/Sentry.framework/Sentry
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 Sentry.framework
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.
In order to send events to Sentry, you will need to activate the InternetClient Capability in your Player Settings.
This is a known limitation 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.
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.
The screenshot capture relies on Unity's ScreenCapture.CaptureScreenshotIntoRenderTexture
function. When capturing errors in the Editor, this might lead to artifacts or scaling issues in the captured screenshot.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").