Skip to main content
Version: 21 Aug 2024

Running Your App (Unity)

This guide walks through how to run Unity apps in the Application Simulator.

caution

The Magic Leap App Simulator is no longer being developed or supported. The package only works when using the XR workflow and a Magic Leap Unity SDK version prior to version 2.0.0.

Graphics Compatibility for Application Simulator with Unity

Your Unity application should use the following graphics APIs in order to run with the Magic Leap Application Simulator.

OpenGLVulkanMetal
Windows 10/11
macOS (Intel)
macOS (M1)

Prerequisites

Configure Unity for Use with Application Simulator

This section describes how to configure your Unity Project settings so that you can test your application inside the Magic Leap Application Simulator.

IMPORTANT

The 2.x.x version of the Magic Leap Unity SDK and Unity Example packages available from the Package Manager target OpenXR and do not support the C API Application Simulator. Developers using Magic Leap C API are advised to continue using version 1.12.1 or older of the Unity SDK and Unity Examples.

Assign Magic Leap SDK Path

The Magic Leap SDK Path setting will only show after the Magic Leap XR package is imported. If the Magic Leap SDK path setting is not visible, make sure that the com.magicleap.xr package was correctly imported in the Package Manager for the Unity Editor.

  1. Open Edit > Preferences on Windows (or macOS: Unity > Settings), then navigate to External Tools > Magic Leap.
  • Set the MLSDK path to the Magic Leap SDK you downloaded from the ML Hub earlier. For example:
    • Mac: $HOME/MagicLeap/mlsdk/<Version>/
    • Windows: %USERPROFILE%/MagicLeap/mlsdk/<Version>/
  1. In the same window, if the path to the Application Simulator Runtime does not get populated automatically, check the Override box and select the path to the latest version of the App Simulator Runtime package. This location can be found by clicking the Open folder link underneath the package's name inside ML Hub's Package manager.
note

To locate the Magic Leap C SDK, open the ML Hub application and go to Package Manager> My Tools, under Common Packages expand Magic Leap C SDK and select the Open Folder or Open Shell. Note the path in the file explorer or shell.

XR Plugin Management

The Magic Leap XR Provider needs to be enabled before using Magic Leap's platform features. To do this:

  1. Go to File > Build Settings > Player Settings > XR Plug-in Management and enable Magic Leap as a Plug-in Provider on the Android platform.

  2. In the Windows, Mac, Linux settings tab, select Magic Leap App Simulator (formerly known as Zero Iteration). This step is required for App Simulator to run properly.

note

If you are having any issues applying these changes, restart the Unity Editor. An editor restart may also be required for Application Simulator to run correctly.

Player Settings

For content of your Unity project to appear in Application Simulator, you must configure your project's graphics settings as described below:

  1. Open the Player Settings Window (Edit > Project Settings > Player) section, then select the 'Standalone' tab.
  2. In the Resolution and Presentation settings, enable Run In Background ( Resolution and Presentation > Resolution).
  3. Expand the Other Settings and under Rendering adjust the following graphics APIs:
    1. Uncheck – Auto Graphics API for Windows, then add OpenGLCore. Once added remove any other Graphics APIs. Changing this setting may restart the Unity Editor.
    2. Uncheck – Auto Graphics API for Mac, then add Metal (If you are using an Apple M chip) OR OpenGLCore (If you are using an Apple computer with an Intel Chip). Once added remove other Graphics APIs. Changing this setting may restart the Unity Editor.

Starting the App Simulator

See the App Simulator Setup guide for detailed steps on installing and starting the Application Simulator.

Running Unity Applications

With the App Simulator running in the Magic Leap Hub, enter Play mode on the Unity Editor. Once in Play mode, you should notice the application content shows up in Application Simulator's Device view for a simulator target, or you will see the content show up in your headset for a device target.

Screenshot of Unity and Magic Leap App Simulator running side-by-side