Search code examples
androidunity-game-engineaugmented-realityvuforiaarcore

Unity ARCore XR settings and Vuforia enable(or switch) at Runtime in Android UnityPlayer


I am adding UnityPlayer inside Android View. I am trying to use 2 different scenes for AR in Unity. Scene: 1 => Welcome screen to decide,device supports ARCore Scene: 2 => If the device supports ARCore, launch ARcore scene from my Android Activity Scene : 3 => If the device does not support ARCore, launch Vuforia scene from my Android Activity

So, for scene 1, I need to enable ARCore Supported in XR Settings For scene 2, I need to enable Vuforia Augmented Reality Supported in XR settings Not able to enable both options. So is it possible to set these options at runtime, before launching Unity Player from my Activity?


Solution

  • No. You can't currently do this now but this might change in the future. The reason is because there is no way to disable ARCore at this moment. You can probably suggest that as a feature on their Github page and explain you need it.

    For Vuforia, you can disable it with VuforiaBehaviour.Instance.enabled = false; and enable it by setting it to true again.

    The problem is that you can't do the-same with ARCore. You might be able to do the-same thing by finding all ARCore components in the scene and disabling them but I am not sure if that will release the camera or even work at-all.