Unitys released some Magic Leap examples so creators can get an idea of what the Magic Leap 1 is capable of. Here’s a step-by-step guide to running the Gestures examples in Magic Leap Simulator with Unity.
Before you launch Unity, you’ll need to have the magic leap simulator up and running. If you’re not sure how to do that here’s some handy guides that’ll get you setup:
- Setting up the Magic Leap Examples in Unity
- Setting up the Magic Leap Lumin SDK & Remote Simulator
- Loading Virtual Rooms in the Magic Leap Simulator
1. Load the Gestures Example
Open the Gestures Scene in Unity.
2. Update the Projects Build Settings
Before we can run the scene we need to update the build settings. Open the File menu and click Build Settings.
In the Build Settings window select Lumin OS as the Platform. Then set the Lumin SDK Location by clicking the button with three dots on it.
In the file chooser window navigate to the Lumin SDK, then click Choose.
If you’re not sure where the Lumin SDK is located you can find the path in the Magic Leap Package Manager. Click on the Lumin SDK row in the Common Packages table, then click Open Folder in the right pane. It should open the finder on the SDK.
Once you’ve set the Lumin SDK Location and selected Lumin OS as the platform click Switch Platform.
3. Enable Zero Iteration Mode
Before we run the project we need to enable zero iteration. Click on the Magic Leap Menu, then click on Enable Zero Iteration.
Once the zero iteration libraries are imported you’ll need to restart Unity. Click Restart in the popup. If the libraries are already loaded then you’ll get a popup asking if you want to reimport them.
4. Run the Gestures Example
Click the Play button to run the gesture example.
After a few moments you’ll see the gestures example load in the game window in Unity.
5. Playing with the Gestures Example in the Magic Leap Simulator
If you switch to the Magic Leap Simulator window you should see the gestures example in the Eye View pane.
Click Gestures in the left property menu.
Click on different gestures in the Gestures tab.
When you choose gestures in the Gestures tab you should see the selected gesture turn green in the Eye View pane. You’ll also see some dots appear showing where the (imaginary) hand is positioned in the view.
You can use gestures from either hand, and the simulator can detect the gestures from both hands at the same time.
To move the green dots which represent where your hands are when they’re making the gestures you can update the transform x,y,z coordinates for the Position and Orientation and you’ll see the dots move accordingly.
If the gestures example doesn’t load in the Magic Leap Simulator try stopping the simulator and shutting everything down including Unity. Launch the Magic Leap Simulator and start it up, then once it’s up and running, start Unity.
< Previous: Loading the Magic Leap Examples in Unity