You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Singleton GameObject created at startup (SentryUnityOptions) to cache stuff on UI thread (revert from deferred execution)
Cache aggressively all values that profiler shows (any timestamps visible in dotTrace)
// Not cached and must be called from UI thread, won't be shown if `SentrySdk.CaptureEvent` called on non-UI threadSystemInfo.batteryStatusSystemInfo.batteryLevel
Input.deviceOrientation
// Cached, isn't shown in dotTrace, must be called from UI threadSystemInfo.processorCount
SystemInfo.processorType
SystemInfo.supportsVibration
// etc// Cached, shown in dotTrace, must be called from UI threadnewLazy(()=>SystemInfo.deviceUniqueIdentifier)
new Lazy(()=>SystemInfo.deviceModel)
new Lazy(()=>SystemInfo.graphicsDeviceVendorID.ToString())// etc
Task.Run(() => SentrySdk.CaptureEvent(sentryEvent)); must not fail and send the event
If SentrySdk.CaptureEvent is called from non-UI thread, make sure the event processing won't fail (because of calling Unity APIs from non-UI thread). But if SentrySdk.CaptureEvent is called in UI thread and then non-UI thread (Task.Run), populate the data from cached value
// In order to have `SystemInfo.deviceType` set in `SentryEvent.Device.DeviceType`, we must call it from UI thread.// first call, non-UI thread, `SentryEvent.Device.DeviceType` is `null`Task.Run(()=>SentrySdk.CaptureEvent(sentryEvent));// second call, UI thread, `SentryEvent.Device.DeviceType` is NOT `null` and equals to 'Desktop'SentrySdk.CaptureEvent(sentryEvent);// third call, non-UI thread, `SentryEvent.Device.DeviceType` is NOT `null` and equals to 'Desktop'Task.Run(()=>SentrySdk.CaptureEvent(sentryEvent));
Tests
The text was updated successfully, but these errors were encountered:
GameObject
created at startup (SentryUnityOptions
) to cache stuff on UI thread (revert from deferred execution)Task.Run(() => SentrySdk.CaptureEvent(sentryEvent));
must not fail and send the eventSentrySdk.CaptureEvent
is called from non-UI thread, make sure the event processing won't fail (because of calling Unity APIs from non-UI thread). But ifSentrySdk.CaptureEvent
is called in UI thread and then non-UI thread (Task.Run
), populate the data from cached valueThe text was updated successfully, but these errors were encountered: