Tutorial written by Nakisa Donnelly and Circuit Stream.

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!

These four steps include:

  • Putting device into Creative Mode
  • Configuring Unity for Magic Leap development
  • Organizing Developer Certificates
  • Loading your app onto your Magic Leap One

 

Skip to the Technical Steps

 

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

ML1 Creator Mode

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.

Download our 10-week AR Development with Unity Course Syllabus


 

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.

  1. Open up the Unity Technical Preview downloaded from the Magic Leap Package Manager
  2. Select New, enter project name and save location for the project (in our example below, we titled our project ‘Appendectomy’)
  3. Select the Magic Leap template and click on Create Project

Create Magic Leap Unity Project

Perfect! Now, we’ll head into Unity and switch platforms from your PC to Magic Leap One.

  1. Open Unity, and open your saved Scene
  2. Click File > Build Settings
  3. Under the Platform section:
    1. Select Lumin OS
    2. Switch Platform
    3. Magic Leap switch platform

  4. Then, under the Lumin OS section, you’ll need to set the location of the Magic Leap Unity Package:
    1. Enable Sign Package
    2. Set the Lumin SDK Location path (wherever you have it saved on your PC). For example, C:/Users/you/MagicLeap/mlsdk/v0.10.0

Magic Leap save SDK location

Now, the last step of configuring Unity is to import the Magic Leap Unity Package into your Unity scene. This connects important libraries in the package to both Unity and your Magic Leap project.

  1. Under Unity’s Assets menu, select Import Package and click Custom Package
  2. Navigate to the location you specified above, for example, C:/Users/you/MagicLeap/tools/unity/v0.17.0/MagicLeap-0.17.0
  3. 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!

In your browser, head over to the Magic Leap Creator Portal. Log in if you haven’t already, and click on Publish > Apps.

First, we’ll generate a certificate. In the Magic Leap Creator Portal, click Publish > Certificates, then Create Certificate or Add New.

ML1 Create Certificate

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.

ML1 Generate Certificate

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:

ML Build Settings

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

ML certificate publish settings

Fantastic! We’re now ready to actually put your app onto your Magic Leap One.
 

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!

Download Syllabus

Technical Steps:

 
Put Device in Creator Mode

  1. Connect ML1 to your PC by USB
  2. On the device, navigate to Settings > Device > Creator Mode
  3. Make sure you’re signed in to your Magic Leap ID and select the following:
    1. Enable Creator Mode
    2. Allow Untrusted Sources
    3. Enable MLDB Access

     
    Configuring Unity

  4. Open Unity Technical Preview downloaded from Magic Leap Package Manager
  5. Select New, enter project name and specify save location for project
  6. Select Magic Leap template and click on Create Project
  7. In Unity, go to File > Open Scene > Open your desired scene
  8. Under Platform section:
    1. Select Lumin OS
    2. Click Switch Platform
    3. Under Lumin OS, enable Sign Package
    4. Set Lumin SDK Location path
  9. Back in Unity, navigate to Assets > Import Package and select Custom Package
  10. Navigate to the Magic Leap Unity package and Open
  11. Click All and Import
  12.  
    Generate Certificate(s)

  13. Open browser and head to Magic Leap Creator Portal, click on Publish > Apps
  14. Click Publish > Certificates
  15. Click Create Certificate or Add New
  16. Enter your name or company name as Certificate name
  17. Once Certificate is generated, download it and ensure .cert and .privkey files are included
  18. Move .cert and .privkey files to your Magic Leap project folder (same folder as .mpk)
  19. Open Magic Leap project in Unity
  20. Click File > Build Settings
  21. Navigate to Platform, select Lumin OS and click Sign Package
  22. Expand Player Settings to view Publishing Settings
  23. Set the ML Certificate property to the path where your .cert file is located. Note: Do not lose Certificate or .cert & .privkey files! If lost, you’ll need to make a new certificate.
  24.  
    Put App on Device

  25. Connect ML1 to PC through USB
  26. Open project in Unity and open desired Scene
  27. Click on File > Build & Run
  28. Save the MPK. The building player window will still be displayed for others to watch
  29. Put on ML1 device, accept certificate on device when prompted. Note: Prompt will disappear if you take too long to put on device, and the app won’t install
  30. Test the app!