-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
[Unity] Update initialization behaviour on mobile
#1907
Comments
mobile
mobile
Update after giving the implementation a try: The IssueWe need to handle three distinct scenarios for native support:
Currently, this would require multiple boolean flags that are confusing and can create invalid combinations i.e.
Proposed SolutionReplace multiple flags with a single enum: // If false, do not modify the Xcode/Gradle project. If set to `false` at build time but `true` at runtime
// we can check whether we can find the native SDK and log a configuration error.
public bool IsNativeSupportEnabled = true;
// Default: Runtime
public enum NativeInitializationType
{
Runtime, // Copy the native SDK, allow runtime configuration, initialize through the C# layer
BuildTime, // Copy the native SDK, bake options into the project, set up auto-init outside of Unity
// UaaL, // (For the future) Don't copy the SDK but attempt to sync scope with the surrounding native SDK
} This:
|
This is available on version: 3.0.0-beta.0 |
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:
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)
Desktop Platforms (Windows/Linux/macOS)
Configure
are the ones that initialize the native layerProposed Solution
1. Unified Configuration API (mostly done already)
Configure
methodOptionConfiguration
to replaceRuntime/BuildTime
#1888: Implement unified scriptable object for configuration callback2. Unified SDK Initialization
iOS Implementation
Instead of handling filecopy ourselves we can mark.framework
for targeting iOS.Unity will handle that for us since we'll never know whether we'll need it. The SDK can and will be initialized during runtime..xcframework
on versions 2020 and older.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?
The text was updated successfully, but these errors were encountered: