November 7, 2018

How to Deploy your AR App onto Magic Leap for Testing

You’ve set up your Magic Leap One for development, and built an AR app – or at least a prototype – using Unity. After testing in the simulator, it’s time to deploy your app onto Magic Leap One itself and test its functionality. Here are the four steps you need to know to do this. Disclaimer: This is for Windows PCs only!

Step 1: Putting device into Creator Mode

To begin configuring Magic Leap One, you’ll need to connect your headset to your computer through the USB cord in the original packaging. Make sure you’re signed in to your Magic Leap ID and registered as a developer. Open up the device on your computer, and navigate to Settings > Device > Creator Mode.

From here, make sure you:

Enable Creator Mode

Allow Untrusted Sources

Enable MLDB Access

Creator Mode specifically allows the device to be able to work with your app. Allowing untrusted sources means that your unpublished app is able to be installed – Magic Leap approves all published apps, so this is a workaround while you’re still perfecting your prototype. Enabling MLDB access allows your PC to access and configure your device while connected through the USB.

We won’t be touching the headset for a while, so you might as well plug it in to start charging so it’s ready to go for testing.

Step 2: Importing Magic Leap Assets into Unity

At this stage of developing your Magic Leap app, it’s safe to presume you’ve downloaded the Lumin SDK and Magic Leap Package Manager already. And if you have built a project with Magic Leap assets, then you’ve already configured Unity to work with Magic Leap and you can skip this step. If not, well, you’re not ready to deploy an app to the device yet, so check out this post on how to set up your Magic Leap One for development first. Otherwise, read on!

First, we’ll need to create a Magic Leap project. This is how the device will read your Unity project as an app for testing.

Open up the Unity Technical Preview downloaded from the Magic Leap Package Manager

Navigate to the location you specified above, for example, C:/Users/you/MagicLeap/tools/unity/v0.17.0/MagicLeap-0.17.0

Click All then Import

Great! You’ve now set your existing Unity scene to be platform-specific to Magic Leap One. Note that you can do this before you build your scene, but it is a step necessary before you can deploy your app onto your device.

Step 3: Organizing Developer Certificates

In order to actually install apps on your Magic Leap One, you have to sign your app with a certificate. This registers the app to your developer account on Magic Leap, and marks it as your intellectual property. This is a big deal!

Enter a name for your certificate — this should either be your name or your company’s name. Think of it as who you want holding the rights to your app. Note that you can only generate up to two certificates.

Your privatekey.zip file will begin downloading. This is only available at this step, so don’t misplace your private key! If you lose it, you must generate a new certificate!

After a certificate is generated (you might need to refresh the page until the status changes from pending to active), you’re ready to continue. Once it’s generated, download the certificate and make sure both the .cert file and .privkey file are included. Move the .cert and .privkey files into the same location as you saved your Magic Leap project back in step two.

Awesome, you’re doing great! Now we just have to sign the certificate to your app. To do this, open the Magic Leap project in Unity, and click File > Build Settings. Navigate to the Platform, select Lumin OS, click the checkbox for Sign Package, and expand Player Settings:

Set the ML Certificate location to the path where your .cert file is in your Magic Leap project folder.

Step 4: Loading your app onto your Magic Leap One

Before we get started, you’ll want to make sure that:

Your Controller is powered on

Your device is turned on and not asleep/locked

You’re able to view the application launcher

Awesome. We’ll connect your Magic Leap One to your PC through the USB once more and transfer the app to it through Unity. Once your device is connected through the USB, open your project in Unity and make sure the scene we’ve been working with is selected under the Build Settings.

In Unity, click on File > Build & Run. Then, save the MPK. The building player window will be displayed.

You can now disconnect your device from your computer and put it on. There will be a prompt to accept the certificate on the device (click Accept!). Please note that if you take too long to put on the device, the prompt may dismiss and the app won’t install.

That’s it! Look around and start testing! Anyone with you not wearing the headset can monitor what you see by looking at your PC screen.

Congratulations, you’re one step closer to publishing your polished app for Magic Leap! If you’re looking for guidance in building AR, we can help with that. Through our 10-week course and one-on-one training, we’ll take you from idea to prototype to finished app. Download our syllabus to learn more about what we can teach you!

Technical Steps:

Put Device in Creator Mode

Connect ML1 to your PC by USB

On the device, navigate to Settings > Device > Creator Mode

Make sure you’re signed in to your Magic Leap ID and select the following: