How to Use Vuforia Engine and AR Foundation in Separate Unity Scenes

For some use cases, it might make sense to combine Unity’s AR Foundation with Vuforia Engine in the same Unity application. Currently, it is not possible to use both in the same Unity scene, but they can be used in the same app in separate scenes. As an example, you might want to leverage ARKit’s Environment Probes in one AR experience in your app and use Vuforia Model Targets in another scene.

For this method to work, set up two separate scenes, one with AR Foundation objects and components (e.g. AR Session Origin, AR Session, AR Point Cloud etc.) and another one with Vuforia Engine objects and components (e.g. ARCamera, Image Target(s), Model Target(s) etc.). If you haven’t setup Vuforia Engine before, please follow the guide in this link.

After you have your scenes set up, make sure to add them to the Build Settings. To change between the Vuforia Engine and AR Foundation scenes, you can simply use the following code snippet:

using UnityEngine;
using UnityEngine.SceneManagement;
using Vuforia;

public class ChangeScene : MonoBehaviour
{
    public void OpenSceneVuforia()
    {  
        VuforiaRuntime.Instance.InitVuforia();
        SceneManager.LoadSceneAsync("VuforiaScene");
    }
    public void OpenSceneFoundation()
    {
        VuforiaRuntime.Instance.UnloadVuforia();
        SceneManager.LoadSceneAsync("ARFoundationScene");
    }
}

This has been tested and verified on/with:

  • Vuforia Engine 9.1
  • Unity 2019.2.21f1
  • AR Foundation 2.0.2+

NOTE: For this to work, you need to initialize Vuforia Engine before loading the scene in-which it is used, and to unload it before loading the scene that uses AR Foundation.

TIP: If you receive a Colliding Attributes gradle error on Android builds, it can be resolved by disabling the Include ARCore Library in the Vuforia Configuration.

 

Player Settings

You will be required to modify some of the settings as listed below in the PlayerSettings -> Other:

  • For Vuforia Engine on iOS, set the iOS version to at least 11.
  • AR Foundation requires the Android API level to be 24+ (alias Android 7.0 ‘Nougat’)
  • For AR Foundation, the Architecture has to be set to ARM64 on iOS, and on Android Vulkan, it is not supported, so there you should use GLES3.