Vuforia Engine and AR Foundation

Vuforia Engine can be used alongside AR Foundation in the same scene regardless of which platform you started developing with. Utilize both platforms to enhance your AR project by adding either to your project via Unity’s Package Manager.

Overview and Prerequisites

It is possible to add Vuforia Engine targets to an existing AR Foundation project, and similarly, adding AR Foundation capabilities to Unity project already using Vuforia Engine. AR Foundation support allows you to utilize vertical planes or environment probes in your Vuforia scene or using Model Targets and Area Targets in your AR Foundation scene. 

Requirements

  • Please refer to Supported Versions on the supported Unity Editor versions.
  • AR Foundation 5.0 or later.
  • ARKit and/or ARCore supported device.
  • A Vuforia Developer license key.

UWP Tablets, HoloLens, and Magic Leap devices are not supported for this cross-platform integration.

All Vuforia Engine features are supported and all AR Foundation features are supported with the exception of content scaling. Both platforms draw on the same coordinate system meaning that anchors and plane detection works interchangeably with detecting and positioning AR content in the environment. 

NOTE: Combining Vuforia Engine and AR Foundation in the same scene does add performance overhead and latency. While this is barely noticeable on iOS devices; on Android, this will result in higher latency and less stable tracking of Vuforia targets. 

In any case, we recommend using Vuforia Engine and AR Foundation together only if capabilities of both are needed. For best performance and lowest latency, use Vuforia Engine without AR Foundation.

Adding Vuforia or AR Foundation

When Vuforia Engine targets are added to an existing Unity scene, Vuforia will automatically detect at runtime if AR Foundation is already used. If a scene already contains the ARFoundation game objects, the Vuforia AR Camera GameObject does not need to be added to the scene. 

Unity setup

Make sure that your Unity project is correctly targeting the platform you wish to build to. Also, include the platform provider according to the chosen platform.

Setup from an Empty Unity scene

Make sure that your Unity project is correctly targeting the platform you wish to build to. Also, include the platform provider according to the chosen platform.

  • Install and enable the platform-specific XR Plugin.
    • Go to Window -> Package Manager and install the XR plugin Management package.
    • In Project Settings select XR Plug-in Management -> <platform> and enable the Plug-in Providers (I.e., ARKit, ARCore).

Add Vuforia Engine to an AR Foundation scene.

  1. Add the Vuforia Engine SDK 10.16 or later to the project by using the Package Manager. Firstly, download and import the SDK from Vuforia’s Developer Portal. For more information on adding Vuforia Engine, please see Vuforia Engine Package Hosting for Unity.
  2. Add a license key in the Vuforia Configuration .

NOTE: The VuforiaBehaviour component is automatically added onto the AR Foundation’s AR Camera GameObject at runtime as soon as Vuforia Engine targets are added to an ARFoundation scene. The World Center Mode will be automatically set to Device

Add AR Foundation to a Vuforia Engine scene

The process for adding AR Foundation to an existing Vuforia enabled project is similar. 

  1. Open the Package Manager window and search the list in the Unity Registry for the AR Foundation package. See AR Foundation 5.0 in Unity 2021 if version 5 or later does not appear in the package manager.
  2. Click it and press the install button.

Building an AR Scene

In order to have Vuforia Engine and AR Foundation working side by side, components from both platforms are required in the scene. You should also use only one AR Camera GameObject – namely the Main Camera from ARFoundation. 

NOTE: In order to use Vuforia Engine targets in an ARFoundation scene, at least one Vuforia target needs to be present in the scene at build time. Only adding targets at runtime through scripting is not supported.

The following steps demonstrate how to build an example scene combining Vuforia Engine Image Targets and ARFoundation’s environment probes:

  1. Start by replacing the default camera in the scene with the AR Foundation XR Origin GameObject. Right-click in the Hierarchy and select XR -> XR Origin (Mobile AR).
    1. The Main Camera is child of the XR Origin GameObject
  2. Add from the same menu, the AR Session GameObject.
  3. Add a Vuforia target by right-clicking in the Hierarchy and selecting Vuforia Engine -> … Add any desired content, for example, a sphere as a child to the Vuforia target.

  4. Add the AR Environment Probe Manager component to the XR Origin GameObject.

  5. Create a new material and set its Metallic and smoothness properties to 1 (one). Ensure also that Specular Highlights and Reflections are enabled.
  6. Assign the material e.g. to the sphere that is used as augmentation for the Vuforia target. This will display reflections from the environment probe on the target’s augmentation.

  7. Continue to set up the Build Settings as shown in our Getting Started with Unity guide and build the project to your device for testing. 

Anchors

Vuforia relies on AR Foundation to create Anchors when combined in the same scene. Therefore, the AR Anchor Manager component is required on the XR Origin GameObject.

AR Session

AR Foundation’s ARSession controls the lifecycle of the AR experience and resetting it would reset the data that Vuforia relies on, such as Anchor positions. This would for example occur when a scene is unloaded and the VuforiaBehaviour is destroyed.  

Vuforia Ground Plane

In order to use Vuforia Engine’s Ground Plane (Plane Finder and Ground Plane Stage) feature together with ARFoundation, it is necessary to add the following AR Foundation components to the XR Origin GameObject.

  • AR Raycast Manager 
  • AR Plane Manager

Can this page be better?
Share your feedback via our issue tracker