Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f81ace4
wip
bitsandfoxes Oct 16, 2026
70514de
Support Unity as a Library on iOS with external native initialization
bitsandfoxes Oct 21, 2026
8575da3
c# watchdog no
bitsandfoxes Oct 21, 2026
f01bbb9
external native scope observer, keep context
bitsandfoxes Oct 21, 2026
167d684
native scope observer tweaks
bitsandfoxes Oct 21, 2026
537ee12
pin to ubuntu 24
bitsandfoxes Oct 21, 2026
1c3598d
updated changelog
bitsandfoxes Oct 21, 2026
0cc691b
Nest game transactions in the native trace and inherit its sampling d…
bitsandfoxes Oct 22, 2026
a4e6b39
Add Unity as a Library support on Android
bitsandfoxes Oct 22, 2026
6a2aa6f
Merge branch 'main' into feat/uaal
bitsandfoxes Oct 22, 2026
912c8de
Merge branch 'main' into feat/uaal-android
bitsandfoxes Oct 22, 2026
e2e908a
Use the native trace's baggage for game events and outgoing requests …
bitsandfoxes Oct 23, 2026
d6bdf09
Fail External append exports that still link SentryObjC into UnityFra…
bitsandfoxes Oct 23, 2026
bdf5384
Move UseAppReleaseAndEnvironment to SentryUnityOptions to share it wi…
bitsandfoxes Oct 23, 2026
bddacce
Turn off ANR and tombstone reporting in the game's own process so the…
bitsandfoxes Oct 23, 2026
c2195c8
Use the release, dist and environment the app's SDK persisted in the …
bitsandfoxes Oct 23, 2026
361cb33
Keep the sentry-java classes the External mode looks up by name from …
bitsandfoxes Oct 23, 2026
2677650
Read the process name from /proc/self/cmdline below API 28 so the gam…
bitsandfoxes Oct 23, 2026
1be5dc2
Read the native baggage on first use so snapshots for trace and span …
bitsandfoxes Oct 23, 2026
bcb52d8
Stop refreshing the app's trace on resume once native support closes
bitsandfoxes Oct 23, 2026
ed51550
Close the main process file reader on failure and keep the app's last…
bitsandfoxes Oct 23, 2026
4f2c77d
Drop the External scope observer's environment override since sentry-…
bitsandfoxes Oct 23, 2026
844a3e5
Link the Android Unity as a Library changelog entry to its PR and des…
bitsandfoxes Oct 23, 2026
eecbbda
Merge branch 'feat/uaal' into feat/uaal-android
bitsandfoxes Oct 23, 2026
2b70451
Keep ANR reporting in the game's own process below API 30, where the …
bitsandfoxes Oct 23, 2026
3b194f9
Make closing the Android SDK idempotent now that the close callback i…
bitsandfoxes Oct 23, 2026
8b5af40
Use the shared UseAppReleaseAndEnvironment helper on Android
bitsandfoxes Oct 23, 2026
9c0c3e9
Use the app's user on C# events and logs with external initialization…
bitsandfoxes Oct 23, 2026
5d32e58
Merge branch 'feat/uaal' into feat/uaal-android
bitsandfoxes Oct 23, 2026
849cbca
Use the app's user on C# events on Android, from its SDK when attache…
bitsandfoxes Oct 23, 2026
91fbb28
Recognize the SDK's default user by the scope's initial user so the a…
bitsandfoxes Oct 23, 2026
3912241
Merge branch 'feat/uaal' into feat/uaal-android
bitsandfoxes Oct 23, 2026
03e0ce2
Keep a username or IP address the game sets by comparing every user f…
bitsandfoxes Oct 23, 2026
4859822
Merge branch 'feat/uaal' into feat/uaal-android
bitsandfoxes Oct 23, 2026
c3b5294
Mention the app's user in the Android Unity as a Library changelog en…
bitsandfoxes Oct 23, 2026
8c21117
Merge remote-tracking branch 'origin/main' into feat/uaal
bitsandfoxes Oct 27, 2026
ed325e1
Mark Unity as a Library support with external initialization as exper…
bitsandfoxes Oct 27, 2026
2c023ea
Merge branch 'feat/uaal' into feat/uaal-android
bitsandfoxes Oct 27, 2026
1a362c6
Mark Unity as a Library support on Android as experimental
bitsandfoxes Oct 27, 2026
88314aa
Drop the Ubuntu 24 runner pin and the snapshot reorder that aren't pa…
bitsandfoxes Oct 27, 2026
686fa45
Merge remote-tracking branch 'origin/feat/uaal' into feat/uaal-android
bitsandfoxes Oct 27, 2026
9bc8b9c
Give external initialization its own bridge with respondsToSelector c…
bitsandfoxes Oct 27, 2026
664f49e
Keep a release or environment set through the Editor overrides even w…
bitsandfoxes Oct 27, 2026
a3f9e82
Merge remote-tracking branch 'origin/feat/uaal' into feat/uaal-android
bitsandfoxes Oct 27, 2026
5cbaa0b
Keep a release or environment overridden in the Editor in the game's …
bitsandfoxes Oct 27, 2026
f334634
Pin the External bridge's empty platform scope in the plugin platform…
bitsandfoxes Oct 27, 2026
c4b48f0
Merge remote-tracking branch 'origin/feat/uaal' into feat/uaal-android
bitsandfoxes Oct 27, 2026
1ac43b4
Pass a release or environment overridden in the Editor to sentry-java…
bitsandfoxes Oct 27, 2026
bce16f3
Merge remote-tracking branch 'origin/main' into feat/uaal
bitsandfoxes Oct 28, 2026
b660064
Move the Unity as a Library entry below the fixes in the CHANGELOG
bitsandfoxes Oct 28, 2026
1f6ea96
Merge remote-tracking branch 'origin/feat/uaal' into feat/uaal-android
bitsandfoxes Oct 28, 2026
4017112
Describe the symbol upload in the CHANGELOG by what it does for users
bitsandfoxes Oct 28, 2026
aaeface
Merge remote-tracking branch 'origin/feat/uaal' into feat/uaal-android
bitsandfoxes Oct 28, 2026
cac9cef
Merge the Android and iOS Unity as a Library entries in the CHANGELOG
bitsandfoxes Oct 28, 2026
21f380d
Merge origin/main into feat/uaal-android
bitsandfoxes Oct 29, 2026
bef9a74
Keep the app's user when the game can't read it on resume
bitsandfoxes Oct 29, 2026
e39c710
Load the Android integration in the Editor so its tests run
bitsandfoxes Oct 29, 2026
ff30408
Skip app hang heartbeats while the game is paused
bitsandfoxes Oct 29, 2026
e6be7d1
Re-arm app hang detection as soon as the game resumes
bitsandfoxes Oct 29, 2026
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

### Fixes

- App hang detection no longer reports a false app hang after the game moves to the background. It now stays paused while the game is in the background or out of focus. ([#2895](https://github.com/getsentry/sentry-unity/pull/2895))
- The Linux native SDK now loads on distros with older glibc versions, such as Ubuntu 22.04 and Debian 12. ([#2894](https://github.com/getsentry/sentry-unity/pull/2894))
- Attaching a screenshot no longer stalls the main thread. Unless `SetBeforeSendScreenshot` is set, the frame gets read back from the GPU asynchronously and encoded on a background thread. ([#2835](https://github.com/getsentry/sentry-unity/pull/2835))

### Features

- Added experimental support for Unity as a Library on iOS. With `IosNativeInitializationType` set to `NativeInitializationType.External`, the game attaches to the sentry-cocoa SDK that the app already started instead of bundling and starting its own. Native crashes carry the game's context and breadcrumbs, C# events and logs use the app's release, environment, user, and trace, the game's transactions join the app's trace, and the game's debug symbols are still uploaded automatically. ([#2885](https://github.com/getsentry/sentry-unity/pull/2885))
- Added experimental support for Unity as a Library on Android and iOS. With `AndroidNativeInitializationType` or `IosNativeInitializationType` set to `NativeInitializationType.External`, the game attaches to the sentry-android or sentry-cocoa SDK that the app already started instead of bundling and starting its own. On Android, when the game runs in its own process, it starts sentry-android there and continues the app's trace. Native crashes carry the game's context and breadcrumbs, C# events and logs use the app's release, environment, user, and trace, the game's transactions join the app's trace, and the game's debug symbols are still uploaded automatically. ([#2885](https://github.com/getsentry/sentry-unity/pull/2885), [#2895](https://github.com/getsentry/sentry-unity/pull/2895))
- The SDK now supports Linux ARM64 dedicated servers (Unity 6000.3 and newer, IL2CPP). The native SDK for both backends ships for `x86_64` and `ARM64`, and the build picks the one matching the player. ([#2894](https://github.com/getsentry/sentry-unity/pull/2894))

### Dependencies
Expand Down
1 change: 1 addition & 0 deletions docs/agent-guides/platform-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Runtime initialization writes `io.sentry.auto-init=false`; C# initializes the Java SDK later.
- Build-time initialization writes options to the Android manifest and lets Java auto-initialize.
- Runtime option changes cannot alter build-time initialization behavior.
- External initialization (Unity as a Library, experimental): the export ships no SDK, writes no manifest entries (they would merge into the app's), and keeps the ProGuard consumer rules. At runtime the game attaches if sentry-android is enabled in its process (no user, environment, or trace sync, no close, no NDK app-hang heartbeat). In a secondary process (e.g. `:Unity`), where the app didn't initialize it, the game initializes it from the Unity options with its own cache directory (`cache/sentry-<process>`), so it doesn't take over the main process's session and persisted scope, and with ANR and tombstone reporting off, since the main process's SDK reports the exits of all the app's processes. There it continues the main process's trace, read from that SDK's persisted scope (`cache/sentry/<dsn hash>/.scope-cache/trace.json`) at start and on resume, and turns off its own trace generation. The symbol upload task goes into `unityLibrary/build.gradle` and runs after `merge<Variant>JniLibFolders`, since the app never builds `launcher`. In the main process without an SDK, native support is skipped. The process name comes from `Application.getProcessName` (API 28+) or `/proc/self/cmdline` below. C# sessions are off and the app's release and environment are used unless set.

## Export Processing

Expand Down
8 changes: 8 additions & 0 deletions package-dev/Plugins/Android/proguard-sentry-unity.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
-keep class io.sentry.SentryLevel { *; }
-keep class io.sentry.SentryOptions { *; }
-keep class io.sentry.Hub { *; }
-keep class io.sentry.IHub { *; }
-keep class io.sentry.IScopes { *; }
-keep class io.sentry.HubScopesWrapper { *; }
-keep class io.sentry.SentryTraceHeader { *; }
-keep class io.sentry.BaggageHeader { *; }
-keep class io.sentry.SpanContext { *; }
-keep class io.sentry.ISerializer { *; }
-keep class io.sentry.JsonSerializer { *; }
-keep class io.sentry.Breadcrumb { *; }
-keep class io.sentry.Scope { *; }
-keep class io.sentry.ScopeCallback { *; }
Expand Down
4 changes: 2 additions & 2 deletions package-dev/Runtime/Sentry.Unity.Android.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions package/Runtime/Sentry.Unity.Android.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/Sentry.Unity.Android/ExternalAndroidJavaScopeObserver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Sentry.Unity.Android;

/// <summary>
/// Scope sync for <see cref="NativeInitializationType.External"/>. The game follows the app's trace. When attached to
/// the app's SDK, the app also owns the user. In its own process, the game's SDK needs it.
/// </summary>
internal sealed class ExternalAndroidJavaScopeObserver : AndroidJavaScopeObserver
{
private readonly bool _isAttached;

public ExternalAndroidJavaScopeObserver(SentryOptions options, ISentryJava sentryJava, bool isAttached)
: base(options, sentryJava) => _isAttached = isAttached;

public override void SetUserImpl(SentryUser user)
{
if (!_isAttached)
{
base.SetUserImpl(user);
}
}

public override void UnsetUserImpl()
{
if (!_isAttached)
{
base.UnsetUserImpl();
}
}

public override void SetTraceImpl(SentryId traceId, SpanId spanId) { }
}
Loading
Loading