Skip to content

fix(Unity): Update troubleshooting snippet #13771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions docs/platforms/unity/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,21 @@ description: "Learn more about how to troubleshoot common issues with the Unity

### Disabling the Sentry SDK for selected platforms

By adding the snippet below to an `Editor` directory inside your Unity project, you can set up the ability to automatically disable the Sentry SDK for any targeted platform.
If you want to disable the SDK for a specific platform, you can use the [programmatic configuration](/platforms/unity/configuration/options/programmatic-configuration/) to have your own code run as part of the initialization and disable the SDK like in the example below:

```csharp
using Sentry.Unity;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;

public class PreBuildProcessor : IPreprocessBuildWithReport
public class SentryOptionConfiguration : SentryOptionsConfiguration
{
public int callbackOrder => 0;

public void OnPreprocessBuild(BuildReport report)
public override void Configure(SentryUnityOptions options)
{
if (report.summary.platform is BuildTarget.Android)
{
var sentryOptions =
AssetDatabase.LoadAssetAtPath<ScriptableSentryUnityOptions>("Assets/Resources/Sentry/SentryOptions.asset");
sentryOptions.Enabled = false;
EditorUtility.SetDirty(sentryOptions);
}
#if UNITY_ANDROID
options.Enabled = false;
#endif
}
}

```

### Build input file cannot be found: '\*\*/Libraries/io.sentry.unity/Plugins/iOS/SentryNativeBridge.m'
Expand Down