Skip to main content

127 docs tagged with "Unity"

View All Tags

Anchors

An overview of the Anchors example scene which utilizes the Spaces application.

API Overview

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.

API Overview

Magic Leap's Eye Tracking data is retrieved in two ways.

API Overview

This section provides information on the Gesture Classification API and how to enable it inside your application.

API Overview

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.

API Overview

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.

App Simulator

This document demonstrates how to use the MagicLeapXrProvider to check if the application is using the Magic Leap App Simulator.

Application Simulator for Unity

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.

Audio

This section provides information on using Magic Leap 2's Audio API for audio input and output.

Audio Capture

An overview of the audio capture demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Audio Change Events

This section provides an example script that demonstrates how to subscribe to Magic Leap's Audio change events.

Audio Input

This section provides examples of how to use Magic Leap's APIs to record audio.

Battery Intents

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.

Camera Capture

An overview of the camera capture demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Configure Unity Settings

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.

Controller

An overview of the controller demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Controller Input Events

This section demonstrates how to use Unity's Input System to access input events from the Magic Leap 2 controller.

Create a Project

This section provides instructions on creating a new Unity with a version that is compatible with Magic Leap 2 development.

Custom Fit

An overview of the Anchors example scene which utilizes the Spaces application.

CV Camera

An overview of the cv camera demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Display Overview

Learn various tools to enhance the way Magic Leap 2 displays content.

Error Reporting

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.

Examples

This section demonstrates how to use the Gesture Classification API.

Explicit Intent Example

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.

Eye Tracking

An overview of the eye tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Eye Tracking Overview

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.

Eye Tracking Tracked Pose Driver

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.

Generic Eye Tracking Data

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.

Gesture Classification

An overview of the gesture classification demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Getting Started

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.

Getting Started

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.

Global Dimmer

An overview of the Global Dimmer example scene which showcases global dimming range.

Global Dimming

Learn how to use the Magic Leap 2's unique global dimming technology.

Hand Tracking

An overview of the hand tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Hand Tracking Overview

This section provides information on the core Hand Tracking API and how to enable it inside your applications.

Handling Tracking Loss Events

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.

Haptics

An overview of the Haptics example scene.

Hello Cube

An overview of the hand tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Implicit Intent Example

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.

Install the Tools

This section provides information on how to install and configure the Unity Editor required to develop for Magic Leap 2.

Intents

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.

Intrinsic/Extrinsic Parameters

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.

Magic Leap Eye Tracking Data

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

Marker Tracker API Overview

This section provides an overview of the marker tracker and references to create a custom Marker Tracking script.

Marker Tracker Events Example

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.

Marker Tracker Example

This section includes an example of detecting Fiducial Markers on the Magic Leap 2 headset.

Marker Tracking

An overview of the marker tracking demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Media Player

An overview of the media player demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Meshing

Learn how to create meshes from surfaces detected by the Magic Leap.

Meshing

An overview of the meshing demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Migrating from ML1

This section includes useful information about API changes when migrating Magic Leap 1 applications to Magic Leap 2.

ML Spaces Overview

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.

MLCamera

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.

MLCamera Overview

The Magic Leap 2 MLCamera API allows developers to capture real and virtual content inside their applications.

MLSpace Examples

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.

Photon Fusion

Guide on using the ML2 Photon Fusion example project

Plane Detection

An overview of the planes demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Platform Detection

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.

Power Manager Example

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 Overview

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.

Query Planes

Learn how to query planes Magic Leap that were detected by the Magic Leap.

Quick Start

Instructions on how to download the Magic Leap MRTK Template Project

Render Pipeline Settings

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.

Runtime Configuration

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.

Runtime Voice Intents Example

This section provides details on how developers can create voice commands at runtime. This feature can be helpful when loading content dynamically.

SDK Example Scenes

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.

Segmented Dimmer

An overview of the Segmented Dimmer example scene which showcases the segmented dimming range.

Segmented Dimming

Learn how to dim sections of the display to add contrast to certain objects.

Simple Camera Example

This section includes a simple camera example. A detailed explanation of each function can be found in the Camera Overview guide.

Simple Example

This section includes code examples for developers to reference when implementing voice input in their applications.

Soundfield Components

Detailed descriptions and screenshots of all available components of Soundfield Audio

Spatial Anchors

Learn how to link objects to Spatial Anchors and use them to create persistent content.

Spatial Anchors API

Learn the core API calls required to implement Magic Leap 2's Spatial Anchors API.

Spatial Anchors Examples

Contains code that can be used as a reference or demo Magic Leap 2's Spatial Anchors functionality.

Start/Stop Input

This section provides details on how developers can start and stop tracking voice intents inside their applications.

Unity App Simulator

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

Unity Debugging via Visual Studio

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.

Unity Overview

This section includes information about developing Unity applications for Magic Leap 2.

Unity Platform Defines

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.

Unity Resources

This section provides various samples, tools, and external libraries that you can reference or integrate into your Magic Leap 2 Unity projects.

Unity Sensor Input

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.

Visualize Camera Output

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.

Voice Input System Settings

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.

Voice Intents

An overview of the Voice Intents scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

Voice Intents Overview

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.

Voice Slots

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.

WebRTC

An overview of the WebRTC scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

WebView

An overview of the WebView scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.