I am using plane detection in a scene using ARCore. When first loading a scene which contains an ARCoreSession component, everything works smoothly. On a second load on a scene which uses ARCoreSession, the camera freezes on the last frame recorded in last scene in which the ARBackground worked properly (with Instant Preview) or it just shows a black screen (on a mobile device). Plane detection seems to be working properly and only the camera background is frozen.
Only a single instance of ARCoreSession and camera with ARBackground exist and are enabled at a single time.
VERSIONS USED
Unity: 2019.3.0f6
ARCore SDK for Unity: arcore-android-sdk-1.16.0
Device manufacturer, model, and O/S: Samsung, Galaxy Note9, Android 10
ARCore: 1.16.200302046
Output of adb shell getprop ro.build.fingerprint: samsung/crownltexx/crownlte:10/QP1A.190711.020/N960FXXU5DTD3:user/release-keys
The third example in the repository above shows that using a single instance of ARCore session and camera that will run continuously throughout the application will solve the issue. However this means that plane detection will run continuously throughout the entire application, which is not a behavior I desire. If I try to pause (disable) the camera or the ARSession, the camera freezing issue happens one again.
ADDITIONAL COMMENTS
I have done some research and the only issue somewhat related to mine can be found on this thread: https://github.com/google-ar/arcore-unity-sdk/issues/181#issuecomment-398322188
However, in Example 6 I have created a single scene, and tried to reset the instance of ARCoreSession (destroying and then instantiating a new session). This did not work, and the camera freezing issue happened in this case too.
SPECIFIC ISSUE ENCOUNTERED
I am using plane detection in a scene using ARCore. When first loading a scene which contains an ARCoreSession component, everything works smoothly. On a second load on a scene which uses ARCoreSession, the camera freezes on the last frame recorded in last scene in which the ARBackground worked properly (with Instant Preview) or it just shows a black screen (on a mobile device). Plane detection seems to be working properly and only the camera background is frozen. Only a single instance of ARCoreSession and camera with ARBackground exist and are enabled at a single time.
VERSIONS USED
adb shell getprop ro.build.fingerprint
: samsung/crownltexx/crownlte:10/QP1A.190711.020/N960FXXU5DTD3:user/release-keysSTEPS TO REPRODUCE THE ISSUE
I have created multiple examples of this issue occuring, plus one possible workaround. They're uploaded at this repository. The examples are based on the HelloAR scene from the Google ARCore sdk for unity: https://github.com/alexpalko/Unity-Google-ARCore-Camera-Freeze-on-Scene-Reload
WORKAROUNDS (IF ANY)
The third example in the repository above shows that using a single instance of ARCore session and camera that will run continuously throughout the application will solve the issue. However this means that plane detection will run continuously throughout the entire application, which is not a behavior I desire. If I try to pause (disable) the camera or the ARSession, the camera freezing issue happens one again.
ADDITIONAL COMMENTS
I have done some research and the only issue somewhat related to mine can be found on this thread: https://github.com/google-ar/arcore-unity-sdk/issues/181#issuecomment-398322188 However, in Example 6 I have created a single scene, and tried to reset the instance of ARCoreSession (destroying and then instantiating a new session). This did not work, and the camera freezing issue happened in this case too.