Skip to content

Commit 676821f

Browse files
authored
fix(Unity): Update troubleshooting snippet (#13771)
1 parent bcf0cc1 commit 676821f

File tree

1 file changed

+7
-15
lines changed
  • docs/platforms/unity/troubleshooting

1 file changed

+7
-15
lines changed

docs/platforms/unity/troubleshooting/index.mdx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,21 @@ description: "Learn more about how to troubleshoot common issues with the Unity
88

99
### Disabling the Sentry SDK for selected platforms
1010

11-
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.
11+
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:
1212

1313
```csharp
1414
using Sentry.Unity;
15-
using UnityEditor;
16-
using UnityEditor.Build;
17-
using UnityEditor.Build.Reporting;
1815

19-
public class PreBuildProcessor : IPreprocessBuildWithReport
16+
public class SentryOptionConfiguration : SentryOptionsConfiguration
2017
{
21-
public int callbackOrder => 0;
22-
23-
public void OnPreprocessBuild(BuildReport report)
18+
public override void Configure(SentryUnityOptions options)
2419
{
25-
if (report.summary.platform is BuildTarget.Android)
26-
{
27-
var sentryOptions =
28-
AssetDatabase.LoadAssetAtPath<ScriptableSentryUnityOptions>("Assets/Resources/Sentry/SentryOptions.asset");
29-
sentryOptions.Enabled = false;
30-
EditorUtility.SetDirty(sentryOptions);
31-
}
20+
#if UNITY_ANDROID
21+
options.Enabled = false;
22+
#endif
3223
}
3324
}
25+
3426
```
3527

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

0 commit comments

Comments
 (0)