arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

Supported device keeps ARSessionState.Installing after ARSession.Install()

Open Berenice2018 opened this issue 6 years ago • 3 comments

Hello,

I want to check if the Android device is supported and use the script SupportChecker.cs from the master branch. (ARCore and ARKit are optional, in my app). My test devices are supported, but in case the Google Services for AR are not installed, the following happens: After yield return ARSession.Install(); the ARSession.state seems to keep being Installing as if a listener is not working. Then, the code in the else branch is executed and therefore the non-AR fallback experience is started. However, the AR session will be started, if I comment out my code for the non-AR fallback. (If I close and re-open the app, the ARSession.state is equal to Ready.)

I do not think that this is the expected behaviour. It will result in a worse UX. Could you advise, please? This would be nice.

Unity 2019.2.17 ARFoundation 3.0.1, same happens in 2.0.2 Samsung Galaxy S10 Pixel 2

Berenice2018 avatar Feb 07 '20 00:02 Berenice2018

However, the AR session will be started, if I comment out my code for the non-AR fallback.

That sounds like your devices have ARCore installed already, so there's an error in the logic that detects this. Look at what the ARSession is doing -- the example code was copied from there.

tdmowrer avatar Feb 07 '20 00:02 tdmowrer

Many thanks @tdmowrer for pointing me to the right direction. Now, I simply listen to the ARSessionStateChangedEvents and start the non-AR experience accordingly. It works fine.

One more question, because I want to localize a message according to the NotTrackingReason. What do the enum values Relocalizing and Unsupported stand for? I mean under which circumstances would I get these values during an ARSession?

Berenice2018 avatar Feb 07 '20 22:02 Berenice2018

"Relocalizing" usually means the device has lost tracking and is trying to reestablish it. For example, if you cover the camera with your finger and then uncover it, you might see this. You would also see it when you first enable AR.

"Unsupported" means the device cannot tell you why tracking has been lost. See also https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.XR.ARSubsystems.NotTrackingReason.html

tdmowrer avatar Feb 08 '20 02:02 tdmowrer