Skip to main content
Version: 11 Nov 2025

MagicLeapFeature

NameSpace: Features

Enables the Magic Leap OpenXR Loader for Android, and modifies the AndroidManifest to be compatible with ML2.

Inherits from:
MagicLeapOpenXRFeatureWithInterception< Features.MagicLeapFeature >,
MagicLeapOpenXRFeatureBase,
OpenXRFeature

Public Fields​

EnablePerceptionSnapshots​


public bool EnablePerceptionSnapshots { get; set; }


Public Methods​

void ApplyNearClip​

public void ApplyNearClip(
ref float zNear
)

Parameters

TypeNameDescription
ref floatzNear

void ApplyToCamera​

public void ApplyToCamera(
Camera camera,
bool warnIfNearClipChanged =true
)

Parameters

TypeNameDescription
Cameracamera
boolwarnIfNearClipChanged

long ConvertSystemTimeToXrTime​

public long ConvertSystemTimeToXrTime(
long systemTime
)

Parameters

TypeNameDescription
longsystemTime

long ConvertXrTimeToSystemTime​

public long ConvertXrTimeToSystemTime(
long xrTime
)

Parameters

TypeNameDescription
longxrTime

void SetNearClipPolicy​

public void SetNearClipPolicy(
NearClipMode mode
)

Parameters

TypeNameDescription
NearClipModemode

Protected Methods​

HookGetInstanceProcAddr​

protected override IntPtr HookGetInstanceProcAddr(
IntPtr func
)

Parameters

TypeNameDescription
IntPtrfunc

MarkFunctionsToIntercept​

protected virtual override void MarkFunctionsToIntercept()

Reimplements: MarkFunctionsToIntercept


OnAppSpaceChange​

protected override void OnAppSpaceChange(
ulong xrSpace
)

Parameters

TypeNameDescription
ulongxrSpace

OnInstanceCreate​

protected override bool OnInstanceCreate(
ulong xrInstance
)

Parameters

TypeNameDescription
ulongxrInstance

OnInstanceDestroy​

protected override void OnInstanceDestroy(
ulong xrInstance
)

Parameters

TypeNameDescription
ulongxrInstance

OnSessionBegin​

protected override void OnSessionBegin(
ulong xrSession
)

Parameters

TypeNameDescription
ulongxrSession

OnSessionCreate​

protected override void OnSessionCreate(
ulong xrSession
)

Parameters

TypeNameDescription
ulongxrSession

OnSessionDestroy​

protected override void OnSessionDestroy(
ulong xrSession
)

Parameters

TypeNameDescription
ulongxrSession

OnSessionEnd​

protected override void OnSessionEnd(
ulong xrSession
)

Parameters

TypeNameDescription
ulongxrSession

OnSessionStateChange​

protected override void OnSessionStateChange(
int oldState,
int newState
)

Parameters

TypeNameDescription
intoldState
intnewState

OnSubsystemCreate​

protected override void OnSubsystemCreate()

OnSubsystemDestroy​

protected override void OnSubsystemDestroy()

Public Attributes​

FarClipPolicy​


public FarClipMode FarClipPolicy => farClipPolicy;


FeatureId​

The feature id string. This is used to give the feature a well known id for reference.


public const string FeatureId = "com.magicleap.openxr.feature.ml2";


MaxFarZ​


public float MaxFarZ => viewConfigurationDepthRange.MaxFarZ;


MinNearZ​


public float MinNearZ => viewConfigurationDepthRange.MinNearZ;


NearClipPolicy​


public NearClipMode NearClipPolicy => nearClipPolicy;


RecommendedFarZ​


public float RecommendedFarZ => viewConfigurationDepthRange.RecommendedFarZ;


RecommendedNearZ​


public float RecommendedNearZ => viewConfigurationDepthRange.RecommendedNearZ;


Public Enums​

FarClipMode​

EnumeratorValueDescription
NoneDo not restrict the Camera's far clip plane distance.
MaximumRestrict the Camera's far clip plane distance to no more than the maximum allowed by the device.
RecommendedRestrict the Camera's far clip plane to no more than the distance recommended by Magic Leap.

NearClipMode​

EnumeratorValueDescription
MinimumRestrict the Camera's near clip plane to no less than the absolute minimum allowed (25cm).
RecommendedRestrict the Camera's near clip plane to no less than the distance configured in the system's settings.