Programmatic Configuration and Native Support on Mobile
Background
The SDKs current approach let's the native SDKs self-initialize when targeting mobile. This approach guarantees the SDK to capture all errors (even Unity engine crashes) but it also creates a lot of friction for users during onboarding and setup.
Having to explain the different layers is a non-trivial task.
Example:
A user wants to set the environment:
For that they have to implement both, the Runtime and the BuildTime configuration. Even with the unified approach of having only one configure callback, they are still limited to setting a static string and are not able to compute the value at runtime. That limitation has to somehow be explained again.
Current State
The Unity SDK currently handles native support differently across platforms:
Mobile Platforms (Android, iOS)
Current Implementation: Native SDKs self-initialize outside Unity runtime
Mechanism: Configured through Gradle (Android) and Xcode (iOS) project modifications
Advantages:
Can capture Unity crashes
Challenges:
Configuration gets "baked" into the project at build time
Complex configuration layers confuse users.
Inconsistent runtime/build time configuration patterns even with the unified configure callback
Desktop Platforms (Windows/Linux/macOS)
Current Implementation: Native SDKs initialize within Unity runtime
Behavior: Uses Configure callback consistently across C# Unity SDK and native layers. The options at the end of Configure are the ones that initialize the native layer
Proposed Solution
1. Unified Configuration API (mostly done already)
Replace separate Runtime/BuildTime configuration with single Configure method
Issue #1887: Separate CLI options from build time configure
Issue #1888: Implement unified scriptable object for configuration callback
Programmatic Configuration and Native Support on
Mobile
Background
The SDKs current approach let's the native SDKs self-initialize when targeting
mobile
. This approach guarantees the SDK to capture all errors (even Unity engine crashes) but it also creates a lot of friction for users during onboarding and setup. Having to explain the different layers is a non-trivial task.Example:
string
and are not able to compute the value at runtime. That limitation has to somehow be explained again.Current State
The Unity SDK currently handles native support differently across platforms:
Mobile Platforms (Android, iOS)
Desktop Platforms (Windows/Linux/macOS)
Configure
are the ones that initialize the native layerProposed Solution
1. Unified Configuration API (mostly done already)
Configure
method2. Unified SDK Initialization
iOS Implementation
.framework
for targeting iOS.isEnabled
property to avoid reinitialization.Android Implementation
.jar
and `.aar for targeting Android.Init
callisEnabled
property to avoid reinitialization.3. Mobile Platform Auto-Initialization
Convert current auto-initialization to opt-in feature. This way we maintain crash capture capabilities for users who need it.
4. Future Enhancement
Implement native callback support. I.e. enable code/snippet injection for native SDK events (e.g.,
BeforeSend
)Benefits
Simplified Configuration
Improved Initialization Flow
Enhanced Flexibility
Migration Path
We're going to have to make sure to let users know about the behavioural change. I.e. a popup notice during package update?