Search Unity

Bug Severe performance problems in all versions of ARCore Plugin 4.1.0-preview9 onwards

Discussion in 'AR' started by LucasHehir, Nov 30, 2020.

  1. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Unity Version: 2020.1.8f1

    Our current AR project has uncovered some pretty interesting behavioural issues in all versions of ARCore newer than 4.1.0-preview7.

    A tiny bit of app context first. Our AR scene begins with the standard PlaneManager component activated and a script that lets the user tap to raycast onto active planes. We use the raycast result to orientate the camera with a positional offset relative to the hit position using an intermediary transform. We do this instead of moving the content itself so our designers can work off a shared global space + scale, etc, pretty standard stuff.

    This process and our content has worked perfectly well in all versions of ARFoundation / ARCore up until 4.1.0-preview7. Any versions thereafter are riddled with inexplicably low framerates, but only after a particular point in the app; the above innocuous raycasting. It goes from a stable 60fps to 30fps (VSYNC-related I understand) and only degrades further.

    At this point, we do start activating some basic mesh-based content, so I'm aware that the issue could technically be related to something in our project... but the exact same section of the app runs perfectly at a very stable 60fps on the same device (Pixel 3 XL) as long as the version is 4.1.0-preview7 or lower. Using a newer version simply breaks performance. It's mind-boggling!

    Moreover, this is accompanied by sporadic native (!) crashes which seem to originate from com.google.ar.core, according to Cloud Diagnostics crash reports. The stack traces for these crashes go all the way down to the native Unity player loop it would seem:

    Code (CSharp):
    1. Native StackTrace:
    2. Thread 0 (crashed)
    3. 0   base.apk                           0x00000075c88eb87c <system symbols missing>
    4. 1   base.apk                           0x00000075c88e8b70 <system symbols missing>
    5. 2   base.apk                           0x00000075c88e83dc <system symbols missing>
    6. 3   base.apk                           0x00000075c88e769c <system symbols missing>
    7. 4   base.apk                           0x00000075c88e6f44 <system symbols missing>
    8. 5   base.apk                           0x00000075c91ad25c <system symbols missing>
    9. 6   base.apk                           0x00000075c9198adc <system symbols missing>
    10. 7   libarpresto_api.so                 0x00000075d8f1c780 <system symbols missing>
    11. 8   libarpresto_api.so                 0x00000075d8f1a810 <system symbols missing>
    12. 9   libarpresto_api.so                 0x00000075d8f195f0 <system symbols missing>
    13. 10  libUnityARCore.so                  0x00000075d8e748c8 <system symbols missing>
    14. 11  libil2cpp.so                       0x0000007665f4c410 NativeApi_UnityARCore_session_update_mE26F37A325850F3DFBDF5DE9D7AA20DC564AAD01 (Unity.XR.ARCore.cpp:28615)
    15. 12  libil2cpp.so                       0x0000007665eae838 XRSessionSubsystem_Update_mB98D19BDD6613D1140C2FEDE5107B87DEE9960AC (Unity.XR.ARSubsystems.cpp:87)
    16. 13  libil2cpp.so                       0x00000076659d7a54 ARSession_Update_mF2C8C33579C2D606200802FE4F7668268DAD1828 (Unity.XR.ARFoundation.cpp:34729)
    17. 14  libil2cpp.so                       0x00000076655d7f14 RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void (*)(), MethodInfo const*, void*, void**) (Il2CppInvokerTable.cpp:51370)
    18. 15  libil2cpp.so                       0x00000076656c817c il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) (Runtime.cpp:565)
    19. 16  libunity.so                        0x0000007667366ad8 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
    20. 17  libunity.so                        0x00000076673734e4 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
    21. 18  libunity.so                        0x000000766737c904 MonoBehaviour::CallUpdateMethod(int)
    22. 19  libunity.so                        0x000000766724d900 void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
    23. 20  libunity.so                        0x00000076672c65d0 ExecutePlayerLoop(NativePlayerLoopSystem*)
    24. 21  libunity.so                        0x00000076672c6604 ExecutePlayerLoop(NativePlayerLoopSystem*)
    25. 22  libunity.so                        0x00000076672c683c PlayerLoop()
    26. 23  libunity.so                        0x00000076673deb38 UnityPlayerLoop()
    27. 24  libunity.so                        0x00000076673f2420 nativeRender(_JNIEnv*, _jobject*)
    28. 25  base.odex                          0x00000076be5573ac <system symbols missing>
    The observed behaviour seems to particularly affect 'older devices' like the Pixel 3a and Pixel 3 XL, although it has also been seen on Samsung Note 9, Pixel 4 and various other devices.

    Our app also uses ARCore Extensions, which requires Unity 2020.1 and ARCore Plugin of at least 4.1.0-preview5 apparently, leaving us with only 3 viable versions to use.

    I'd love to understand what is happening here. Has anyone else experienced something similar? The issue is still present in the fully-released ARFoundation 4.1.1.