How To Migrate a Unity Project

The following migration steps are included below:

These migration steps generally assume an upgrade from one version prior unless noted otherwise. If you are migrating to a version of Vuforia Engine that is several releases ahead of your existing version, we recommend reading through the intermediate release notes for additional details. Also please refer to our articles documenting the changes in new releases:


Vuforia Unity Extension 8.1 Migration Guide

  1. New Platform Support
    1. Android ARM64 Support
      Vuforia 8.1 now supports ARM64 bit on Android. Simply select IL2CPP as your scripting backend and add ARM64 to the Target Architectures in the Android player settings of your project:

      Configuration dialog
    2. BitCode Support
      The iOS version of Vuforia 8.1 now contains Bitcode. Provided any other dependencies of your project also contain Bitcode, you may build with Bitcode enabled and use this for App Store submission. It is recommended to test Bitcode recompilation by making an Archive build and then exporting an Ad Hoc .ipa, selecting the "Recompile from Bitcode" option.

      Bitcode is automatically enabled by Unity when it creates the Xcode project. To build without Bitcode, edit the project and turn it off.

      Note that due to a limitation in the recompilation process, if you are going to build for Bitcode then you must embed VuforiaDL.framework in your app even if you are not using a feature that requires it. This is the default behaviour.
  2. API and Workflow Changes
    1. Model Target 3D Guide View Extraction
      With Vuforia 8.1, we have changed the mechanism for Model Target extraction in Unity. The extracted 3D models are used for guide views and editor previews of Model Targets. Previously, the 3D mesh was extracted and set up in a Unity scene once “3D guide view” was selected for a model target in that scene.
      This has now changed so that the mesh is extracted at the time a Model Target dataset is imported into a Unity project. At that time, a prefab is created on the project level in the Resources/VuforiaModels folder. This prefab is used by default for both the editor preview of a model target and when 3D guide views are used at runtime. This makes it easier to update all instances of Model Targets when importing a new version of a database into the project.
      The model extraction can be disabled in the Vuforia configuration if the extracted 3D models are not needed for guide views, preview models, augmentations or if you want to reduce the size of your application.
      If model target extraction is disabled, 3D guide views are not available for model targets in your project.
      If your Vuforia 8.0 (or earlier) project used 3D Model Target guide views, please follow these steps to migrate it to Vuforia 8.1:
      • Open the project with new Vuforia SDK 8.1 -> notice that a new folder Resources/VuforiaModels is generated
      • If your project used the extracted models for anything other than 3D guide view functionality (e.g. as augmentation assets), you’ll need to assign the guid of the old prefab to the new prefab:
        • Close the Unity editor
        • Open meta-files of old (Assets/Models/) and new (Resources/VuforiaModels/) prefab and swap the guid values of the two prefabs
        • Open Unity editor again and verify that new prefabs are used in your scene
        • Alternatively, you can manually replace all instances of 3D guide view prefabs with the new prefab by manually adding them to the scene
      • If you no longer need them, delete all previously extracted 3D models from the folder Assets/Models. There is a separate subfolder for each database.
    2. Public changes to Image class
      The Vuforia Image class has been refactored and optimized for better memory usage. This resulted in the following changes for Vuforia 8.1:
      • The enum Image.PIXEL_FORMAT is replaced by PIXEL_FORMAT. If you used that enum in your code, you’ll need to fix any compiler errors by changing to the new enum.
      • The PIXEL_FORMAT.YUV format was replaced with more explicit format YUV formats by introducing PIXEL_FORMAT.NV21 and PIXEL_FORMAT.NV12.
        If you previously used the YUV format you now need to check for the NV21 or NV12 formats.
        Please note that not all formats are supported on every platform. Rule of thumb:
        • NV12: native image format on iOS and UWP tablet devices
        • NV21: native image format on Android
          There are exceptions to this, for example the Google Pixel C device uses other YUV based formats
      • Image.IsValid() has been marked deprecated and can be replaced with the static Image.IsNullOrEmpty(Image) method.
      • Image.Clear() and Image.ClearUnmanagedData() have been removed, they are not required anymore.
  3. Removed APIs and Features
    1. Front Camera Support
      The previously deprecated front camera functionality has been removed with Vuforia 8.1. You can now only access the back camera.

      As part of this change, the reflection flag was removed as well, which was enabling mirrored rendering. If you still need to have mirror rendering due to your current setup, this is best done in a post processing effect in Unity.
    2. Model Recognition Template Mode
      The template mode for trained Model Targets has been removed with Vuforia 8.1. If you used Model Recognition in your Vuforia 8.0 Unity project, please follow these steps:
      • If you did not use template mode, just remove the template object below the Model Recognition game object in your Unity scene
      • If you did use templates in your project, please follow these steps to implement a similar mechanism on application level:
        • Keep the template game object and make sure that no dataset has been assigned to it (editor shows ---EMPTY--- dataset)
        • Create a custom ModelRecoEventHandler by copying the DefaultModelRecoEventHandler script
        • Instantiate the template object in the OnNewSearchResult method
    3. Other removed APIs
      The following methods, interfaces and classes have been deprecated in previous Vuforia versions and have now been removed with Vuforia 8.1:
      • PositionalDeviceTracker.CreateMidAirAnchor(string name, Transform transform):
        Use CreateMidAirAnchor(string name, Vector3 position, Quaternion rotation) instead.
      • DeviceTrackerARController.FusionProvider: Use VuforiaRuntimeUtilities.SetAllowedFusionProviders instead.
      • ICloudRecoEventHandler: Use IObjectRecoEventHandler instead.
      • ObjectTracker.TargetFinder: Use GetTargetFinder instead.
      • AnchorStageBehaviour: use AnchorBehaviour instead.
      • FusionProviderType. OPTIMIZE_IMAGE_TARGETS_AND_VUMARKS and OPTIMIZE_MODEL_TARGETS_AND_SMART_TERRAIN: Use ALL instead.
      • VuforiaRuntime.HasInitialized: use VuforiaRuntime.InitializationState or VuforiaManager.Initialized instead.
    4. Newly deprecated APIs
      The following field has been deprecated in Vuforia 8.1 and will be removed in a future Vuforia version:
      • TargetFinder.CloudRecoSearchResult.TargetSize

Migrating Unity Projects to Vuforia Engine 7.2

Extended Tracking

In Vuforia Engine 7.2, the Extended Tracking API has been deprecated. The functional equivalent continues in the form of the Device Tracker.  Developers can enable Extended Tracking functionality by enabling the Positional Device tracker.

Developers migrating applications which use Image Targets, VuMarks, Multi-Targets, Cylinder Targets or Object Targets and are looking for equivalent Extended Tracking functionality as pre 7.2 should follow these steps:

  1. Open the Vuforia Configuration panel (Windows> Vuforia Configuration or Ctrl+Shift+V)
  2. Check the "Track Device Pose" option under the "Device Tracker" section
  3. Confirm that the Tracking Mode is set to "POSITIONAL"
  4. Select "Optimize for Image Targets and VuMarks" for "Fusion Mode"
Vuforia Image

The following APIs have been deprecated:

  • Target.StartExtendedTracking()
  • Target.StopExtendedTracking()

Instead of calling these APIs for each target, call TrackerManager.Instance.InitTracker<PositionalDeviceTracker>() once to enable Extended Tracking functionality on all targets. Be sure to start the Device Tracker.

For more information on Extended Tracking, please refer to the Extended Tracking documentation.

Device Tracker

The Device Tracker no longer requires a specific World Center Mode. Device Tracker can work alongside all World Center Modes.

Targets will continue to report pose information when the target is out of view and Device Tracking is enabled. If Device Tracking is not enabled and the target goes out of view, tracking will be lost (NO_POSE).

Device Tracking can be enabled in the Vuforia Configuration Panel as seen in the previous screenshot.

Device Tracking can also be enabled via code:

  void Awake(){
     VuforiaARController.Instance.RegisterVuforiaInitializedCallback  (OnVuforiaInitialized); 
 } void OnVuforiaInitialized() {
     deviceTracker = TrackerManager.Instance.InitTracker<PositionalDeviceTracker>(); 
 }

The device tracker can now be started/stopped anytime at runtime without the need to re-initialize the camera with:

deviceTracker.Start();

and

deviceTracker.Stop();

For more information on the Device Tracker, please refer to Using the Device Tracker document

Vuforia Fusion

Also part of Vuforia Engine 7.2, we are updating the Device Tracker to leverage Vuforia Fusion. Vuforia Fusion refers to the internal techniques used by the Vuforia Engine to take advantage of the best platform enablers (such as ARCore and ARKit) while still providing developers with the broadest reach of devices.

Vuforia Fusion works by choosing the best technology for Device Tracking. Please refer to the following list for default priority:

Vuforia Fusion Default Priority:

  1. Platform Enablers (ARKit/ARCore)
  2. Vuforia VIO
  3. Vuforia SLAM

Due to addition of support for platform enablers, it is important that AR content, targets, and physical objects all have their coordinate scale in meters. Objects that do not have their scale set appropriately may not track well.

 

For more information about Vuforia Fusion, please refer to the Vuforia Fusion documentation.

World Center Mode

  • DEVICE - The camera now moves if the device tracker is enabled. If the device tracker is not enabled, the camera will stay fixed at the last position. Targets always moves in this mode.
  • FIRST_TARGET / SPECIFIC_TARGET - The first Target or the specified target will be at the last position and not move
If your experience uses physics or otherwise requires a GameObject to remain static for performance reasons, consider using SPECIFIC_TARGET.

ARCore

To enable ARCore support in Unity, please refer to Using ARCore with Vuforia document.

Front Facing Camera

Front-facing camera support has been deprecated in Vuforia Engine 7.2.

Vuforia Engine Initialization

Vuforia Engine 7.2 has made some changes to the initialization process that may impact the flow of your application. The default initialization behavior of Vuforia Engine 7.2 is to download the latest device profile in order to deliver the best experience on the device.  Depending on the speed of the user's internet, this could add several seconds to application load. This only occurs the very first time the user launches the app and will not impact application loading in future launches of the app.

It is strongly recommended to allow the Vuforia Engine to fetch the latest device profile. Developers looking to disable this behavior should set the following hint before initializing Vuforia Engine: VuforiaUnity.SetHint(VuforiaHint.HINT_ASYNC_FETCH_OF_LATEST_CALIBRATION, 1);

Migrating Unity Projects to Vuforia Engine 7.1

Vuforia Engine 7.1 included improvements to Database loading and activation. Developers looking to migrate from Vuforia Engine 7.0 to 7.1 that have customized how Databases are loaded and activated via code should review Automatic Database Loading in Unity

Migrating Unity Projects to Vuforia Engine 6.5

The process of migrating projects from Vuforia Engine 6.2 to 6.5 integrated with Unity 2017.2 is outlined here: Migrate Unity Projects from Vuforia Engine 6.2 to 6.5

Migrating Unity Projects to Vuforia Engine 6.2

The Vuforia Unity Extension version 6.2 introduces the global configuration editor, OpenGL 3 support and some other API changes. Frame markers are not supported anymore and have to be replaced by VuMarks. Vuforia Engine 6.2 drops the support for Unity 5.2 and now supports Unity 5.3 and 5.4.