Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
2.98k stars 1.11k forks source link

[Bug][IN-35599] MultiThreaded Rendering crash AR Foundation when enable/disable AR Session #1075

Closed ROBYER1 closed 4 months ago

ROBYER1 commented 1 year ago

Reported to Unity with Bug: IN-35599 - [AR Foundation] MultiThreaded Rendering crash AR Foundation when enable/disable AR Session on iOS+Android

Working on a simple AR app recently using Unity as a library (UAAL) to embed Unity inside a native app using AR Foundation 5.0.5 in Unity 2022.2.10 for Android and iOS. At first I thought the crashes were due to UAAL, so I did some builds of the Unity app on its own to iOS/Android devices. I noticed when I disabled/enabled the AR Session component and the AR Camera gameobject with Multithreaded Rendering enabled, the app would crash sometimes when doing this.

As soon as I disabled Multithreaded Rendering in player settings, the crashes stopped happening.

I found this issue here but nobody logged a bug for this and multiple users mentioned disabling multi-threaded rendering fixed their crash issue as it did for me. There are quite a few issues on github where people mentioned this too but not a single one of them bothered to file a Unity bug and report back! https://github.com/Unity-Technologies/arfoundation-samples/issues/95#issuecomment-1132424075

I get the following error from Xcode: Code (CSharp): libc++abi: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ARFrame storageMode]: unrecognized selector sent to instance 0x1514753f0' terminating with uncaught exception of type NSException

ROBYER1 commented 1 year ago

Forum post: https://forum.unity.com/threads/in-35599-multithreaded-rendering-crash-ar-foundation-when-enable-disable-ar-session.1413507/#post-8901600

ankur-unity commented 1 year ago

@ROBYER1 - Our QA was able to reproduce the issue on iOS devices but not on Android devices. Here is the public issue tracker. https://issuetracker.unity3d.com/issues/ar-foundation-player-crashes-when-continually-enabling-and-disabling-ar-session-on-mobile-devices-if-multithreaded-rendering-is-enabled

ankur-unity commented 4 months ago

Closing as the issue was resolved in your bug project.

Also note that we recently fixed another multi-threaded rendering bug in ARKit which might be related to your case. https://docs.unity3d.com/Packages/com.unity.xr.arkit@5.1/changelog/CHANGELOG.html#fixed