Skip to content

feat(Unity ): Added APK+OBB initialization to troubleshooting #14668

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
28 changes: 28 additions & 0 deletions docs/platforms/unity/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ This happens if you've copied some of the SDK files directly to the Assets folde

## Runtime issues

### Android: Initialization fails - APK+OBB

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;

public class GameInitializer : MonoBehaviour
{
private void Start()
{
SentrySdk.Init(options =>
{
options.Dsn = "YOUR_DSN_HERE";
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.
Prior to version `4.0.0`, native support is limited when programmatically initializing the SDK.

### Library not loaded: @rpath/Sentry.framework/Sentry

If you encounter the following error:
Expand Down