Android Oculus Quest IL2CPP build crashes, while editor and Mono works fine

Hello, we have run into an issue with PUN2. We have an application for Oculus Quest (2) implementing a multiplayer via PUN2. Unity applications at Oculus Store for Oculus Quest platform are required to use IL2CPP instead of Mono for reasons beyond this forum post.

The crash scenario is pretty simple and copies tutorials. We create a room, join it, start game and change scene via Photon. The Awake and Start methods of Monobehaviours in the scene get called, but before we can see a first frame in the new scene the app crashes. The app also crashes if I try to change to an empty scene however everything works just fine in editor or while using Mono backend.

I tried on both Quest (Android 7) and Quest 2 (Android 10) HMDs. I tried to upgrade Unity to latest 2020 LTS version (2020.3.20f1). I tried the latest PUN (2.38) and I also tried the fix for IL2CPP on UWP from PUN Known issues.

This is the crash backtrace from logcat, which I know looks like a Unity bug, but happens only when using PUN2 with IL2CPP. Any help would be much appreciated. Many thanks!

FATAL EXCEPTION: UnityMain
Process: com.sensearena.sensearena, PID: 4686
java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2020.3.20f1 (41c4e627c95f)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
Build fingerprint: 'oculus/hollywood/hollywood:10/QQ3A.200805.001/19130100199900000:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2021-10-14 13:21:54+0200
pid: 4686, tid: 4711, name: UnityMain  >>> com.sensearena.sensearena <<<
uid: 10097
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000007b3c7d09f8  x1  0000007b342866b8  x2  0000007b8e52b3a8  x3  0000000000000001
    x4  0000000000000000  x5  00000000ffffffff  x6  00000000ffffffff  x7  000000000043f99a
    x8  0000000000000000  x9  0000000000607978  x10 0000007b3085a000  x11 0000000000000000
    x12 0000000000000001  x13 000000008f7c7200  x14 0000000000008af2  x15 0000ad3672a98ee0
    x16 0000007b3c99c458  x17 0000007c27b4efec  x18 0000007b342622e0  x19 0000007b3c7d09f8
    x20 0000007a5b89e580  x21 0000007a5bb9caf8  x22 0000007b3ddfa9c0  x23 0000007b3ddfa000
    x24 0000007b3ddfa000  x25 0000007b3ddfa000  x26 00000000ba2e8ba3  x27 0000007a5cc4e240
    x28 0000007b34286ee0  x29 0000007b34286670
    sp  0000007b34286660  lr  0000007b3b18374c  pc  0000007b3b183824
    
backtrace:
libil2cpp.0x6ef7824(Native Method)
libil2cpp.0x6ef7748(Native Method)
libil2cpp.0x6ef7bd8(Native Method)
libunity.GarbageCollectSharedAssets(bool, bool)(GarbageCollectSharedAssets:680)
libunity.UnloadUnusedAssetsOperation::IntegrateMainThread()(IntegrateMainThread:16)
libunity.PreloadManager::UpdatePreloadingSingleStep(PreloadManager::UpdatePreloadingFlags, int)(UpdatePreloadingSingleStep:276)
libunity.PreloadManager::WaitForAllAsyncOperationsToComplete()(WaitForAllAsyncOperationsToComplete:144)
libunity.PreloadManager::UpdatePreloading()(UpdatePreloading:184)
libunity.InitPlayerLoopCallbacks()::EarlyUpdateUpdatePreloadingRegistrator::Forward()(InitPlayerLoopCallbacks:64)
libunity.ExecutePlayerLoop(NativePlayerLoopSystem*)(ExecutePlayerLoop:80)
libunity.ExecutePlayerLoop(NativePlayerLoopSystem*)(ExecutePlayerLoop:168)
libunity.PlayerLoop()(PlayerLoop:400)
libunity.UnityPlayerLoop()(UnityPlayerLoop:744)
libunity.nativeRender(_JNIEnv*, _jobject*)(nativeRender:72)
libart.art_quick_alloc_array_resolved_region_tlab(art_quick_alloc_array_resolved_region_tlab:112)

Answers

  • Tobias
    Tobias admin
    edited October 15

    I'm sorry you are running into such an issue. There are currently no known issues that match this problem. In fact, we know that some games are successfully released on Quest 2.

    Overall, this is a Unity bug, as the "promise" is that IL2CPP and Mono deliver about the same results.

    So your client does connect and run. Only when you start the game in the room and load the next scene, things fail, right?

    Did you try to load a blank scene? If the Awake and Start methods of Monobehaviours in the scene get called, this could be part of the problem.

    Does the same crash happen in a standalone build with IL2CPP?

  • Hello Tobias and thank you for replying!

    Yes, that is right. Yes I have also tried to load only an empty scene with just a cube object and a light and the app crashes as well. I haven't tried a standalone build, but I will give it a go.

    I will also try to come up with a minimum crashing example to help to identify the issue.

  • I think it makes sense to submit this to Unity as a bug (and there the minimal project is also of help). It will be interesting to know what the standalone version does.

    It could actually also be an issue related to the Oculus integration (and in those, to a specific version) but I have no first hand experience, which versions are fine and which have issues.

    On the Unity side, 2020.3.20f1 should be fine but then again, even LTS versions get the occasional issue.