Skip to main content
Version: 20 Mar 2024

MLDevice

NameSpace: MagicLeap

MagicLeap device class responsible for updating all trackers when they register and are enabled.

Inherits from:
MonoBehaviour

Public Fields

GestureSubsystemComponent

Gets the active XRMagicLeap gestures subsystem.


public static GestureSubsystemComponent GestureSubsystemComponent { get; set; }


Instance

Gets the MLDevice singleton instance.


public static MLDevice Instance { get; set; }

TypeDescription
MLDeviceMagicLeap device class responsible for updating all trackers when they register and are enabled.

PlatformLevel

Gets the platform API level that the OS supports.


public static uint PlatformLevel { get; set; }


Public Methods

bool IsMagicLeapLoaderActive

public static bool IsMagicLeapLoaderActive()

bool IsMagicLeapOrOpenXRLoaderActive

public static bool IsMagicLeapOrOpenXRLoaderActive()

bool IsOpenXRLoaderActive

public static bool IsOpenXRLoaderActive()

bool IsReady

Check if the underlying Unity XRMagicLeap subsystem is initialized.

public static bool IsReady()

Returns: Value indicating whether the XRMagicLeap subsystem is initialized.


delegate void OnDestroyEventDelegate

Delegate to handle Update calls.

public delegate void OnDestroyEventDelegate()

delegate void OnFocusEventDelegate

Delegate to handle application focus events.

public delegate void OnFocusEventDelegate(
bool hasFocus
)

Parameters

TypeNameDescription
boolhasFocusWhether app is focus gained or lost.

delegate void OnPauseEventDelegate

Delegate to handle application pause events.

public delegate void OnPauseEventDelegate(
bool paused
)

Parameters

TypeNameDescription
boolpausedWhether app is paused or resumed.

delegate void OnQuitEventDelegate

Delegate to handle application quit events.

public delegate void OnQuitEventDelegate()

delegate void OnStartEventDelegate

Delegate to handle Update calls.

public delegate void OnStartEventDelegate()

delegate void OnUpdateEventDelegate

Delegate to handle Update calls.

public delegate void OnUpdateEventDelegate()

void RegisterApplicationFocus

Unrgister a MagicLeap API application focus callback to be called OnApplicationFocus of this behavior.

public static void RegisterApplicationFocus(
OnFocusEventDelegate callback
)

Parameters

TypeNameDescription
OnFocusEventDelegatecallbackCallback to register.

void RegisterApplicationPause

Unrgister a MagicLeap API application pause callback to be called OnApplicationPause of this behavior.

public static void RegisterApplicationPause(
OnPauseEventDelegate callback
)

Parameters

TypeNameDescription
OnPauseEventDelegatecallbackCallback to register.

void RegisterApplicationQuit

Register a MagicLeap API application quit callback to be called on OnApplicationQuit of this behavior.

public static void RegisterApplicationQuit(
OnQuitEventDelegate callback
)

Parameters

TypeNameDescription
OnQuitEventDelegatecallbackCallback to register

void RegisterDestroy

Register a MagicLeap API Update callback to be called on Destroy of this behavior.

public static void RegisterDestroy(
OnDestroyEventDelegate callback
)

Parameters

TypeNameDescription
OnDestroyEventDelegatecallbackCallback to register.

void RegisterEndOfFrameUpdate

Register a function to be executed per frame at the end of every frame, after all cameras and GUI is rendered but before displaying the frame on screen

public static void RegisterEndOfFrameUpdate(
Action endOfFrameFunction
)

Parameters

TypeNameDescription
ActionendOfFrameFunctionThe function.

void RegisterGestureSubsystem

Attempts to register the Unity GestureSubsystem.

public static void RegisterGestureSubsystem()

void RegisterStart

Register a MagicLeap API Update callback to be called on Start of this behavior.

public static void RegisterStart(
OnStartEventDelegate callback
)

Parameters

TypeNameDescription
OnStartEventDelegatecallbackCallback to register.

void RegisterUpdate

Register a MagicLeap API Update callback to be called on Update of this behavior.

public static void RegisterUpdate(
OnUpdateEventDelegate callback
)

Parameters

TypeNameDescription
OnUpdateEventDelegatecallbackCallback to register.

void UnregisterApplicationFocus

Unregister a previously registered MagicLeap API application focus callback.

public static void UnregisterApplicationFocus(
OnFocusEventDelegate callback
)

Parameters

TypeNameDescription
OnFocusEventDelegatecallbackCallback to unregister.

void UnregisterApplicationPause

Unregister a previously registered MagicLeap API application pause callback.

public static void UnregisterApplicationPause(
OnPauseEventDelegate callback
)

Parameters

TypeNameDescription
OnPauseEventDelegatecallbackCallback to unregister.

void UnregisterApplicationQuit

Unregister a previously registered MagicLeapAPI application quit callback.

public static void UnregisterApplicationQuit(
OnQuitEventDelegate callback
)

Parameters

TypeNameDescription
OnQuitEventDelegatecallbackCallback to unregister

void UnregisterDestroy

Unregister a MagicLeap API from being called when OnDestroy for this behavior is called.

public static void UnregisterDestroy(
OnDestroyEventDelegate callback
)

Parameters

TypeNameDescription
OnDestroyEventDelegatecallbackCallback to register.

void UnregisterEndOfFrameUpdate

Unregister a function to no longer be executed at the end of the frame

public static void UnregisterEndOfFrameUpdate(
Action endOfFrameFunction
)

Parameters

TypeNameDescription
ActionendOfFrameFunctionThe function.

void UnregisterGestureSubsystem

Attempts to unregister the GestureSubsystem.

public static void UnregisterGestureSubsystem()

void UnregisterStart

Unregister a previously registered MagicLeap API Update callback.

public static void UnregisterStart(
OnStartEventDelegate callback
)

Parameters

TypeNameDescription
OnStartEventDelegatecallbackCallback to unregister.

void UnregisterUpdate

Unregister a previously registered MagicLeap API Update callback.

public static void UnregisterUpdate(
OnUpdateEventDelegate callback
)

Parameters

TypeNameDescription
OnUpdateEventDelegatecallbackCallback to unregister.

Protected Methods

Awake

Initializes the Magic Leap device state.

protected void Awake()

OnDestroy

Cleans up any resources the object has open.

protected void OnDestroy()

Start

Starts the EndOfFrameUpdate coroutine and dispatches the Start event.

protected void Start()

Update

Calls OnUpdateActions event and dispatches all queued callbacks.

protected void Update()

Public Attributes

DefaultNearClipDistance

Hardcoded value with the default near clip plane distance to use.


public const float DefaultNearClipDistance = 0.37f;


MagicLeapDeviceName

MagicLeap platform Unity name.


public const string MagicLeapDeviceName = "MagicLeap";


MainThreadId


public static int MainThreadId => Instance.mainThreadId;


MinimumNearClipDistance

Hardcoded value approximating minimum near clip plane distance allowed by the platform.


public const float MinimumNearClipDistance = 0.37f;


UnityVideoPlayerSupported


public static bool UnityVideoPlayerSupported =>



false;