Agora Realtime Communications SDK
Using Agora with Magic Leap 2 in Unity
Using Agora with Magic Leap 2 in Unity
An overview of the Anchors example scene which utilizes the Spaces application.
This guide provides a walk through of creating a custom camera capture script. The sections in this guide were written in a linear flow although each section can also be referenced individually.
Magic Leap's Eye Tracking data is retrieved in two ways.
This section provides information on the Gesture Classification API and how to enable it inside your application.
Namespace
This guide provides detailed instructions and examples on how to use the MagicLeap's MLPowerManager API for managing power states and properties of components in Unity. The guide first explains the concept of power states, showing how to get all available states and retrieve a specific state for a device. It then delves into the process of setting a power state with thorough examples. The guide proceeds to explain how to get and update the properties of a component, focusing on different aspects like battery info, battery level, charging state, and connection state. Lastly, it touches on how to handle power management events such as errors, state changes, and property changes through callbacks. By following this guide, developers can efficiently control and manage Magic Leap 2's power states and properties inside their Unity Application.
This guide provides a comprehensive overview of the MLSpace API, specifically focusing on the key features and functions used to manage MLSpaces in your applications. It covers topics such as subscribing to the OnLocalizationEvent to monitor localization status changes, fetching available spaces, understanding and getting localization results, localizing into a specific space, and the export and import of spaces. Each topic is explored with detailed explanations and illustrative code snippets, aiming to provide a clear understanding of how to leverage the MLSpace API effectively. The guide offers insights into the usage of key structs, values, and enums, enhancing your ability to create more interactive and responsive applications using MLSpaces.
This document demonstrates how to use the MagicLeapXrProvider to check if the application is using the Magic Leap App Simulator.
The App Sim (short for "Application Simulator) for Unity is an offering that is separate, but related to the App Sim. Previously, it was recommended to use the App Sim (through the Magic Leap Hub), but due to performance and compatibility reasons, it is now recommended following the steps outlined on this page and not using the pattern involving strating the App Sim in the ML Hub, switching to Unity, and clicking Play.
This section provides information on using Magic Leap 2's Audio API for audio input and output.
An overview of the audio capture demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
This section provides an example script that demonstrates how to subscribe to Magic Leap's Audio change events.
This section provides examples of how to use Magic Leap's APIs to record audio.
This section demonstrates how to collect battery information from the Magic Leap 2's Compute Pack and Controller in Unity. See the Android Intents Overview guide for information regarding the native implementation.
This document describes how to build a Magic Leap 2 application using Unity.
An overview of the camera capture demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Instructions on how to add Magic Leap support to an existing MRTK 3 Project
This topic describes how to configure the Unity Build Settings to utilize Magic Leap features.
See our guide for the App Sim for Unity.
You will need to configure a few Unity Settings for the simulator to run properly. This section describes how to configure your Unity Project settings so that you can test your application inside the Magic Leap App simulator.
An overview of the controller demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
This section demonstrates how to use Unity's Input System to access input events from the Magic Leap 2 controller.
Instructions on how to create a new MRTK 3 project compatible with Magic Leap 2
This section provides instructions on creating a new Unity with a version that is compatible with Magic Leap 2 development.
Learn how to headlock content in Unity applications.
An overview of the Anchors example scene which utilizes the Spaces application.
An overview of the cv camera demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
An overview of the Depth Camera example scene.
Introduction
Instructions for enabling Developer Mode on device
Learn various tools to enhance the way Magic Leap 2 displays content.
If you are experiencing issues with the Magic Leap App Simulator, let us know so we can help you get up and running. The App Simulator package makes it easy for users to save all of the diagnostics logs.
This section demonstrates how to use the Gesture Classification API.
Explicit intents specify which application will satisfy the intent, by supplying either the target app's package name or a fully-qualified component class name. Explicit Intents can also be used to pass data to other activities.
An overview of the eye tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
If your Application collects, stores, transfers or otherwise uses data off the Magic Leap 2 device that is received via this API, then you must comply with the Magic Leap 2 Eye Tracking Data Transparency Policy.
If your Application collects, stores, transfers or otherwise uses data off the Magic Leap 2 device that is received via this API, then you must comply with the Magic Leap 2 Eye Tracking Data Transparency Policy.
If your Application collects, stores, transfers or otherwise uses data off the Magic Leap 2 device that is received via this API, then you must comply with the Magic Leap 2 Eye Tracking Data Transparency Policy.
An overview of the gesture classification demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Overview
This section includes information on how to detect if an application is running on a Magic Leap 2 in addition to checking if a developer is most likely building for Magic Leap 2.
These guides serve as a starting point for Magic Leap app development in Unity. If this is your first time developing for Magic Leap, we recommend that you follow the guides sequentially. If you are an experienced Magic Leap developer, these guides can be used as standalone references.
An overview of the Global Dimmer example scene which showcases global dimming range.
Learn how to use the Magic Leap 2's unique global dimming technology.
An overview of the hand tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
This section provides information on the core Hand Tracking API and how to enable it inside your applications.
Overview
If the Magic Leap can't locate its position in an environment, it experiences "tracking loss". The Magic Leap 2 lets developers manage their own tracking loss behavior -- some developers may want to pause the update loop and display a splash image, while others may want the app to continue playing.
An overview of the Haptics example scene.
An overview of the hand tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Implicit Intents do not directly specify the Android components which should be called, it only specifies an action to be performed. This allows a component from another app to handle the action request. For example, you may want to prompt the user to perform eye-tracking calibration.
This section describes how to download and configure the Magic Leap Unity Example project.
This section provides information on how to install and configure the Unity Editor required to develop for Magic Leap 2.
Unity developers can use intents inside their applications to open external activities and services. For example, you can use Intents to open the Eye Calibration application after detecting poor accuracy when using the Eye Tracking feature, or if you want the user to localize into a map before loading the content from your application. This section provides examples of how to call both implicit and explicit intents.
This section includes details on reading the Intrinsic and Extrinsic parameters from the Magic Leap camera. These values can be queried using the MLCamera.ResultExtras value provided in the Camera Capture callbacks.
To obtain Magic Leap device specific features such as checking the eye tracking FixationConfidence status or if the user is blinking use Magic Leap's InputSubsystem.Extensions
Information about MRTK 3 settings for Magic Leap
An overview and walkthrough guide for using the Magic Leap XR Keyboard.
This section provides an overview of the marker tracker and references to create a custom Marker Tracking script.
The Magic Leap 2's marker tracker API is light weight and can be extended depending on your application's needs. This section provides an example of extending the API to broadcast an event when a marker is found, lost or updated based on the amount of time that has passed since the marker was update.
This section includes an example of detecting Fiducial Markers on the Magic Leap 2 headset.
An overview of the marker tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
An overview of the media player demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Learn how to create meshes from surfaces detected by the Magic Leap.
An overview of the meshing demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Learn how to adjust the mesh queries location and bounds.
Learn how the Meshing Subsystem component works and it's features.
Learn to adjust the appearance of the mesh generated by the Magic Leap 2.
This section includes useful information about API changes when migrating Magic Leap 1 applications to Magic Leap 2.
Upgrade to Magic Leap's new Eye Tracking APIs
Using MRTK with Magic Leap 2 in Unity
Instructions on how to get started with Magic Leap MRTK3
Overview of Microsoft's Mixed Reality ToolKit
The MLSpace API allows developers to manage Spaces inside their application. This includes functionality such as querying a list of spaces, requesting localization into a specific Space and importing/exporting on device Spaces.
The Magic Leap 2 MLCamera API allows developers to capture real and virtual content inside their applications. While the Magic Leap 2 has only one camera to capturing content, two separate streams can be access from the camera at the same time. This allows developers to create application that can stream the user's point of view, while using the camera to perform computer vision tasks.
The Magic Leap 2 MLCamera API allows developers to capture real and virtual content inside their applications.
These scripts demonstrate various functionalities of the MLSpace API, which is used for managing spaces in a mixed reality environment. The scripts are broken down into specific functionalities: requesting permissions, retrieving available spaces, localizing into a space, exporting and saving spaces, and importing previously saved spaces. Each script serves as an isolated example of a particular functionality, making it easier to understand and implement these functions in your own projects. They are designed to be used with the Unity game engine and the Magic Leap platform. Note that they should be used in a real device environment for proper functioning.
Guide on using the ML2 Photon Fusion example project
Using Ready Player Me with Magic Leap 2
Learn how the Magic Leap classifies surfaces.
Learn how to detect surfaces using the Magic Leap SDK.
An overview of the planes demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
This section includes details on detecting if an application is running on a Magic Leap 2 and if a developer is targeting Magic Leap in Unity's XR Manager.
This example demonstrates how to manage power states and properties on a device using the Magic Leap platform's Power Manager API. It includes initialization and setup of available power states and properties, reading current power state and properties, and setting a new power state. The code also handles different events that could occur during these operations, such as changes in power state or properties, and potential errors. The detailed logging provides real-time insight into the power management process.
Power Manager provides a set of power management APIs that allow applications to receive callbacks when the power state changes, APIs to get device components power state and properties, and to set the controller’s power states.
Learn how to query planes Magic Leap that were detected by the Magic Leap.
Instructions on how to download the Magic Leap MRTK Template Project
This section assumes you created a new project using the URP template. The URP template project includes a collection of various URP assets, each pre-configured with different settings to represent different levels of quality. However, for Android apps running on our platform, the default configuration does not allow for a smooth 60 FPS experience in even the simplest scene. Follow these steps to configure the URP settings in your project to improve performance.
This section provides details on how developers can create and register voice commands dynamically at runtime. This feature can be helpful when loading content dynamically.
This section provides details on how developers can create voice commands at runtime. This feature can be helpful when loading content dynamically.
The Magic Leap 2 Unity Example Project showcases the Magic Leap's Unity SDK features. This section includes walkthroughs of each example and can be used as a reference point for development or troubleshooting.
An overview of the Segmented Dimmer example scene which showcases the segmented dimming range.
Learn how to dim sections of the display to add contrast to certain objects.
Setting Up MRTK with Magic Leap 2 for Unity
This section includes a simple camera example. A detailed explanation of each function can be found in the Camera Overview guide.
This section includes code examples for developers to reference when implementing voice input in their applications.
Soundfield Plugin Overview
Detailed descriptions and screenshots of all available components of Soundfield Audio
Learn how to link objects to Spatial Anchors and use them to create persistent content.
Learn the core API calls required to implement Magic Leap 2's Spatial Anchors API.
Learn how to get notified when spatial anchors are created, added or removed.
Contains code that can be used as a reference or demo Magic Leap 2's Spatial Anchors functionality.
Contains code that can be used as a reference or demo Magic Leap 2's Spatial Anchors functionality.
Learn how to link objects to Spatial anchors and use them to create persistent content.
Learn how make content appear more stable.
This section provides details on how developers can start and stop tracking voice intents inside their applications.
This section describes how to configure your Unity Project settings so that you can test your application inside the Magic Leap App simulator.
This guide only covers Unity C# script debugging. For C/C++ debugging, i.e. debugging custom or third party libraries, see Unity Native Debugging via Android Studio.
This section includes information about developing Unity applications for Magic Leap 2.
Unity does not contain a specific Platform Defines for Magic Leap 2. Instead, developers are required to create and edit custom defines symbols if they wish to use them when developing their applications. This topic describes how to create a custom directive to identify code you wish to include or exclude from your application. For example, you can choose code that will only be compiled when deploying to the Magic Leap 2.
This section provides various samples, tools, and external libraries that you can reference or integrate into your Magic Leap 2 Unity projects.
Sensors are devices that measure environmental characteristics of the device that the content is running on, such as light, pressure, temperature, orientation, and motion. Unity’s Input System allows you to access sensors on Android devices using the standard Android Sensor API. In this guide, we will show you how to enable, disable, and read data from sensors on Android using the Input System.
VisionLib Tracking on Magic Leap 2 in Unity
This section includes details on rendering the Magic Leap's camera output on a Raw Image UI Component. When receiving camera output developers can query the format using the MLCamera.CameraOutput.Format property.
The Voice Intent API will only register voice commands if Voice Input is enabled inside the Magic Leap 2's System Settings (Settings > Magic Leap Inputs > Voice). This section demonstrates how to check if a user has enabled Voice Input.
An overview of the Voice Intents scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
Magic Leap 2 allows users to trigger events using custom verbal commands called Voice Intents. This section outlines how to set up Voice Intents in your project, example scripts, and an API overview.
A Slot is a placeholder string for a set of potential values. The utterance will use one of the values and the developer can have different logic based on which value was spoken. To indicate use of a slot, put the slot name within { } for the command.
Overview of PTC's Vuforia Engine
An overview of the Wacom Tablet example scene.
Information on how to create your own Web View with the Magic Leap Unity SDK.
Learn how to interact with Magic Leap's Web View API.
Learn about Magic Leap's WebView Feature.
An overview of the WebRTC scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
An overview of the WebView scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.
An overview of the World Camera example.