Developing Vuforia Engine Apps for Magic Leap

Vuforia Engine 8.6 contains beta support for the Magic Leap One Creator’s edition eyewear device. Use the Vuforia Engine to build powerful AR experiences to the Magic Leap devices using Vuforia’s many features including; Image Targets, VuMarks, and Model Targets. Combine robust tracking of the physical environment and objects with the Lumin OS to start creating tailored and augmented instructions to workers and visitors, or spark joy with immersive effects and information to toys, cars, and appliances. Start your Vuforia and Magic Leap journey with the following guide to set up the Vuforia Engine, Magic Leap Lumin SDK, and Unity.

For a guide on how to connect your Magic Leap device, see Magic Leap’s Connect Device documentation.

Get the tools

Start by installing the tools for developing with Vuforia Engine and Unity.

  1. Download Unity 2019.2 or later
    • Ensure that “Lumin OS (Magic Leap) Build Support” is included in the installation.
      • To add the module in an existing 2019.xx Unity installation, open the Unity Hub and navigate to the Installs and click the menu on the version you wish to add additional modules. Proceed to install the Lumin OS module.

  1. Start by creating a new empty Unity 3D project.
  2. Add Vuforia Engine SDK 8.6 for Unity.
  3. Add the Lumin SDK to Unity.

                        Follow Magic Leap’s guide to download and set up the required resources for Unity

                       NOTE: Install the latest Magic Leap Unity Package as well as the Lumin SDK.

Setting up Vuforia Engine and Lumin SDK in the Unity Editor

  1.  In the Unity project, navigate to Edit (Unity on Mac)->Preferences->External Tools and browse to the Magic Leap folder location where you have installed the Lumin SDK.

  1. Navigate to Build Settings and Switch Platform to Lumin. It may take some minutes for this process to finish.
    1. While in the Build Settings window, select the Player Settings and go to Other Settings and change API Compatibility Level to .NET 4.x.
  2. The next step is to download the XR Plugin Management package by using the Unity Editor’s Package Manager.
    1. Go to Window->Package Manager. Scroll to the bottom of the list or type in XR Plugin Management in the search field. Proceed to install the package.
  3. Locate XR Plugin Management by selecting Edits->Project Settings->XR Plugin. Download the Magic Leap Loader to the list by pressing the + icon.
    1. After the download process is finished, proceed to press the + icon once more and choose the Magic Leap Loader under Available section.

At this point, your project is ready for the preconfigured Magic Leap Vuforia Sample. Head over to Working with the Vuforia Magic Leap Sample in Unity to get started.

For a custom set up, continue with the steps below.

  1. Now, continue to import the Magic Leap Unity Package by navigating to Assets->Import Asset->Custom Package.

              a. Select the Unity Package version you wish to add to your project, which can be found in the folder [User]->Magic Leap->Tools->Unity->Vx.xx.x

               NOTE: if you receive an “API update required” notification, go ahead and press ‘I made a

               Backup, go ahead!'.                 

  1. Return to the XR Plugin Management and select Magic Leap Settings.
  2. A notification will show that asks you to create a serialized instance of the settings data. Create one.
  3. Now, sign your Magic Leap application.
    1. Select Player in the project settings and go to publishing settings.
    2. Check the box for sign package and add your Magic Leap certificate. See Get a Developer Certificate if you do not yet possess one.

Unity has now been setup with the Lumin SDK and the Vuforia Enigne.

Adding Vuforia Components

  1. Start by replacing the Camera GameObject with the Magic Leap Main Camera Prefab located in Assets->MagicLeap->Core->Prefabs.

  1. Proceed to add the following components to the Magic Leap Main Camera GameObject.
    • 'Vuforia Behaviour'
    • 'Default Initialization Error Handler' 

  1. Now, we can add Vuforia's Image target to the project. Go to GameObject- >Vuforia Engine and click the Image. This will result in a prompt asking if you “would like to import a Default Database?”. Click import.
  2. Add a Cube GameObject as a child to the ImageTarget GameObject. This can be done by navigating to GameObject- >3D object->Cube.
    • You can use Unity's hand, move, rotate, scale tool to align the cube on top of image target.
  3. Lastly, locate and copy the manifest.xml template from the project hierarchy <Unity-project-root>\Assets\MagicLeap\Examples\Plugins\Lumin> and place the template in <Assets\Plugins\Lumin\>. Open the manifest and add the following privileges.
    • <!-- Additional Vuforia Engine permissions -->
    • <uses-privilege ml:name="ComputerVision"/>
    • <uses-privilege ml:name="LowLatencyLightwear" />
    • <uses-privilege ml:name="CameraCapture" />
    • <uses-privilege ml:name="PcfRead" />
    • <uses-privilege ml:name="Internet" />
    • <uses-privilege ml:name="LocalAreaNetwork" />
  4. Save the project and Save the scene. 

  5. Now go to File-> Build and Run. This should compile and install the .MPK file on your ML device given that it is connected. You will get a prompt asking whether to allow the application to access camera etc. Grant all permissions and look at the Astronaut image target.
  1. You can print the ImageTarget for testing from <Unity-project- root>\Assets\Editor\Vuforia\ForPrint\ImageTargettarget_images_USLetter.pdf