Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 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
6a2aa6f
Merge branch 'main' into feat/uaal
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
1be5dc2
Read the native baggage on first use so snapshots for trace and span …
bitsandfoxes Oct 23, 2026
9c0c3e9
Use the app's user on C# events and logs with external initialization…
bitsandfoxes Oct 23, 2026
91fbb28
Recognize the SDK's default user by the scope's initial user so the a…
bitsandfoxes Oct 23, 2026
03e0ce2
Keep a username or IP address the game sets by comparing every user f…
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
88314aa
Drop the Ubuntu 24 runner pin and the snapshot reorder that aren't pa…
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
f334634
Pin the External bridge's empty platform scope in the plugin platform…
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
4017112
Describe the symbol upload in the CHANGELOG by what it does for users
bitsandfoxes Oct 28, 2026
4944c3e
Replace the bridge on appended iOS exports so it matches the current …
bitsandfoxes Oct 28, 2026
6421df2
Merge branch 'main' into feat/uaal
bitsandfoxes Oct 29, 2026
eb3f865
Fail appended iOS exports that switch away from External with the upl…
bitsandfoxes Oct 29, 2026
61cd0a6
Call void setters through a typed objc_msgSend in the External bridge
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

### 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))
- 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
3 changes: 3 additions & 0 deletions docs/agent-guides/platform-apple.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
- App-hang tracking disables the C# ANR watchdog on iOS and macOS when the Cocoa backend is active.
- macOS Cocoa screenshots are disabled because UIKit is unavailable.
- Cocoa attachment synchronization is not implemented.
- iOS external initialization (experimental): C# never initializes or closes Cocoa, attaches only if the host app already initialized it, keeps the host's SDK name, and disables the C# ANR watchdog. It doesn't sync user, environment, or trace to the host's scope, turns off C# session tracking, uses the host's release and environment unless set, puts the host's user on C# events (per event) and logs (at start and on resume) unless the game sets its own (`NativeAppUser`), continues the host's trace (`NativePropagationContext`, read through the bridge on every use) unless a sampled C# span is active. Transactions started through `Sentry.Unity.SentrySdk.StartTransaction(name, operation)` join the host's trace: as a child of the host's active span, inheriting its sampling decision and DSC, otherwise as a root with sampling deferred to the game.

## iOS Export

- iOS editor code is in `src/Sentry.Unity.Editor.iOS/`.
- It copies `Sentry.xcframework~` and bridge source, mutates the PBX project through reflection, embeds/links the framework, adds `-ObjC`, and can write build-time options into `main.mm`.
- Reflection avoids requiring iOS editor modules on Windows or Linux.
- External exports copy `SentryNativeBridgeExternal.m` as the bridge instead: it looks up the core classes of the app's own SDK (`SentrySDKInternal`, `SentryScope`, `SentryBreadcrumb`) at runtime and checks every selector with `respondsToSelector:`, as Unity builds without Objective-C exceptions. Keep its entry points in sync with the other bridges.
- External exports copy no framework and add the symbol upload build phase to `UnityFramework`, which an embedding app builds.
- Disabled/unconfigured iOS still installs a no-op bridge so P/Invoke symbols resolve.
- Changing an append build from build-time to runtime/disabled requires a Replace export; postprocessing fails rather than preserve stale `main.mm` initialization.

Expand Down
9 changes: 9 additions & 0 deletions package-dev/Plugins/iOS/SentryNativeBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ void SentryNativeBridgeUnsetUser()
return cString;
}

// Only the app's own SDK provides these, see SentryNativeBridgeExternal.m.
char *_Nullable SentryNativeBridgeGetOption(const char *name) { return NULL; }

char *_Nullable SentryNativeBridgeGetTraceHeader() { return NULL; }

char *_Nullable SentryNativeBridgeGetBaggageHeader() { return NULL; }

char *_Nullable SentryNativeBridgeGetUser() { return NULL; }

void SentryNativeBridgeSetTrace(const char *traceId, const char *spanId)
{
if (traceId == NULL || spanId == NULL) {
Expand Down
Loading
Loading