Interoperability between MLSDK and OpenXR APIs
Overview
This document explains how to use the legacy MLSDK APIs with the Magic Leap OpenXR Unity SDK in Unity. Using the legacy APIs allows you to access additional features that are not yet supported by the Magic Leap OpenXR SDK, such as MLWebView
, MLCamera
, MLOcclusion
, and MLVoice
.
As the Magic Leap OpenXR SDK matures, we plan to migrate all of the features into OpenXR compatible features and vender extensions.
Compatibility
As a general rule of compatibility, all existing ML APIs should continue to work when using the Magic Leap OpenXR Unity SDK with the exception of
- Graphics related features such as Global / Segmented Dimming and Headlocked mode
- Subsystem related logic such as Input and Meshing
These features are either incompatible with the OpenXR rendering pipeline or require a different approach to access them. For more information, see the OpenXR Migration Guide.
Supported MLSDK APIs
The following MLSDK APIs are compatible with the Magic Leap OpenXR Unity implementation and can be used in your Unity project:
- WebView: This API allows you to display web content in your app. You can use the
MLWebView
class to create and manage web views. For more information, see the WebView API documentation. - MLCamera: This API allows you to access the camera stream and capture images and videos. You can use the
MLCamera
class to control the camera settings and callbacks. For more information, see the MLCamera API documentation. - MLOcclusion: This API allows you to occlude virtual objects behind real-world surfaces. You can use the
MLOcclusion
class to enable and disable occlusion. For more information, see the MLOcclusion API documentation. - Depth Camera: This API allows you to access the depth data from the device's depth sensor. You can use the
MLDepthCamera
class to get the depth map and point cloud. For more information, see the Depth Camera API documentation. - World Camera: This API allows you to access the world camera stream. You can use the
MLWorldCamera
class to get the world camera texture and pose. For more information, see the World Camera API documentation. - Power Manager: This API allows you to monitor and manage the controller's power state. You can use the
MLPowerManager
class to get the battery level and state of the Magic Leap controller. For more information, see the Power Manager API documentation. - MLAudio: This API allows you to play and record audio in your app. You can use the
MLAudio
class to manage the audio input devices. For more information, see the MLAudio API documentation. - Soundfield Audio: This API allows you to play spatialized audio in your Unity Application. For more information, see the Soundfield Audio API documentation.
- Voice Intents: This API allows you to use voice commands to trigger actions in your app. You can use the MLVoice class to register and handle voice intents. For more information, see the Voice Intents API documentation.
Unchanged APIs
The following MLSDK APIs are unchanged and do not require any special handling when using the Magic Leap OpenXR Unity SDK:
- Permissions: This API allows you to request and check the permissions required by your app. You can use the
MLPermissions
class to manage Magic Leap Specific permissions. For more information, see the Permissions API documentation. - Intents: This is an AOSP API that allows you to launch other apps or services from your app. For more information, see the Android Intents documentation.
- Sensors: Using the Standard Android Sensor API developers can access the device's sensors, such as accelerometer, gyroscope, magnetometer, and pressure sensor.For more information, see the Sensors API documentation.
Unchanged Workflows
The following workflows are unchanged and do not require any special handling when using the Magic Leap OpenXR Unity SDK:
- Debugging: You can use the same tools and methods to debug your app when using the Magic Leap OpenXR Unity SDK. For more information, see the Debugging documentation.