@@ -78,11 +78,15 @@ public static void OnHandleUnresolvedException(object sender, UnhandledException
7878 if ( exception != null )
7979 {
8080 Debug . Log ( "Unhandled exception: " + exception . ToString ( ) ) ;
81+ #if UNITY_IOS && ! UNITY_EDITOR
82+ TrackErrorWithAttachments ( exception ) ;
83+ #else
8184 lock ( _unhandledExceptions )
8285 {
8386 _unhandledExceptions . Enqueue ( exception ) ;
8487 }
8588 UnityCoroutineHelper . StartCoroutine ( SendUnhandledExceptionReports ) ;
89+ #endif
8690 }
8791 }
8892#endif
@@ -326,18 +330,25 @@ private static IEnumerator SendUnhandledExceptionReports()
326330 }
327331 if ( exception != null )
328332 {
329- var exceptionWrapper = CreateWrapperException ( exception ) ;
330- var errorId = CrashesInternal . TrackException ( exceptionWrapper . GetRawObject ( ) , null , null ) ;
331- if ( _enableErrorAttachmentsCallbacks )
332- {
333- SendErrorAttachments ( errorId ) ;
334- }
333+ TrackErrorWithAttachments ( exception ) ;
335334 }
336335 yield return null ; // report remaining exceptions on next frames
337336 }
338337 }
339338#endif
340339
340+ private static void TrackErrorWithAttachments ( Exception exception )
341+ {
342+ var exceptionWrapper = CreateWrapperException ( exception ) ;
343+ var errorId = CrashesInternal . TrackException ( exceptionWrapper . GetRawObject ( ) , null , null ) ;
344+
345+ // If the main thread is not crashed, attachments should be sent.
346+ if ( _enableErrorAttachmentsCallbacks )
347+ {
348+ SendErrorAttachments ( errorId ) ;
349+ }
350+ }
351+
341352 private static WrapperException CreateWrapperException ( Exception exception )
342353 {
343354 var exceptionWrapper = new WrapperException ( ) ;
0 commit comments