# ML Spectator is not working with OpenXR

**URL:** <https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582>\
**Category:** Unity Development\
**Tags:** spectator, unity, openxr, marker-tracker\
**Created:** [May 29, 2024, 7:52am UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582 "2024-05-29T07:52:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![csabai.tamas.93](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@csabai.tamas.93](https://forum.magicleap.cloud/u/csabai.tamas.93)\
**Post date:** [May 29, 2024, 7:52am UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/1 "2024-05-29T07:52:51Z")

</div>

**Unity Editor version** : 2022.3.29f1  
**ML2 OS version** : 1.7.0  
**Unity SDK version** : 2.2.0  
**Host OS** : Windows  
**OpenXR** : 1.11.0  
**ML Spectator** : 1.3.3

Hello,

I'm seeking help with an issue I've encountered while implementing ML Spectator in an OpenXR based Unity project.

The issue is as follows: After I use the ML Spectator App and scan the provided Aruco marker with an iOS device, Magic Leap fails to recognize it and gets stuck in the "_Look at the marker_" phase. After debugging, I've found that the ` **MLMarkerTracker.OnMLMarkerTrackerResultsFoundArray** ` callback always returns an empty array (`**MarkerData[] dataArray**` ), hence the marker is never detected.

![image2](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/3/3ee9df4bad681f4956a5b3469d19ad12ea3576ff.jpeg)

It's important to note that the ML Spectator marker detection utilizes the ML SDK's marker detection, not the OpenXR one.

OpenXR: [Marker Understanding API Overview | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity-openxr/marker-understanding/unity-marker-understanding-api/)

ML SDK: [Marker Tracker API Overview | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/marker-tracking/marker-tracker-api/)

The OpenXR marker detection API works fine. I've replaced the ML Spectator marker detector with the OpenXR Aruco marker tracker, and it works, but it places the objects in a completely different position and orientation on the iOS device than on the Magic Leap. (XR Rig and CameraOffset is in the origo with no rotation)

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/3/32b6ae9b71024307297c21d51ee135dc99e7589c.png)

 ![image3](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/b/b14aa01e4cd6efd419465e1691f732707dbdb3a8.png)

Is there a way to get the original ML SDK Aruco tracker to work under OpenXR?

Or how can I configure the OpenXR Aruco tracker to place objects in the correct transform?

Thanks in advance for your assistance!

![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/d/d84f355b6373e76b64ab98ab6587502576bfd418.png)

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/e/e6589e9ae4d51ecba257af4264c015c42d150496.png)

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [May 31, 2024, 7:20pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/2 "2024-05-31T19:20:54Z")

</div>

Hi @csabai.tamas.93,

Thank you for reaching out regarding this issue. I'm going to test our MLSDK setup with spectator. Are there other OpenXR features that you are looking to use alongside the Marker Tracker? Do you plan to use size estimation at all?

Best,

El

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [May 31, 2024, 10:07pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/3 "2024-05-31T22:07:04Z")

</div>

I was able to get the MLSDK Marker tracking working while working in OpenXR. You can turn on Magic leap in the Plug-in Providers settings page.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/2/27558e9b45f8494cf8710b376067b64f3ca67947.png)

This will allow you to use the MLSDK alongside OpenXR. I will go ahead and submit feedback to our team to let them know about the issues with this and I will report back as soon as I learn more.

Try running the [marker tracking example script](https://developer-docs.magicleap.cloud/docs/guides/unity/marker-tracking/marker-tracker-example/) to see if this works with your spectator as a workaround.

Best,

El

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [May 31, 2024, 10:07pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/4 "2024-05-31T22:07:43Z")

</div>

What are the lighting conditions in your environment like also?

---

<div class="post-metadata">

**Author:** ![csabai.tamas.93](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@csabai.tamas.93](https://forum.magicleap.cloud/u/csabai.tamas.93)\
**Post date:** [June 3, 2024, 9:09am UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/5 "2024-06-03T09:09:09Z")

</div>

Thanks for the reply.

The environment is a well lit office room.

Originally, the "Magic Leap" checkbox didn't show up for me in XR Plugin Management. But after adding the `com.unity.xr.magicleap (7.0.0)` package to the project, it appeared.

![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/8/8e0f297be54fd3a300f4226ec10dadd6aa84b5de.png)

![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/c/c6147976dca0e217b422ac0e00043b074f315a69.png)

So now the original `MLarucoMarkerDetector` script (ML SDK) works for me, but all OpenXR features are lost (e.g., Hand Tracking). I can only get these working again if I remove the `com.unity.xr.magicleap` package and thus the Magic Leap checkbox disappears as well.

Furthermore, with this marker tracking, it also places the virtual objects on the iPhone in a completely different place than where I see them on the Magic Leap. (About 1 meter away and rotated completely differently, facing the ground)

So the primary issue is not with the marker tracking itself, as it can be made to function with both the ML SDK and OpenXR. Rather, the problem lies in the virtual objects being placed in entirely different locations in space than where they should be.

Magic Leap:

 ![ML_20240603_09.05.47](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/2/26836bc7368e9fbffc4701fb718830caac13ca20.jpeg)

iOS Spectator:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/4/433ec1023fe8c2ede634e2572a9e41df62438ed9.jpeg)

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [June 7, 2024, 4:44pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/6 "2024-06-07T16:44:31Z")

</div>

Where is your main camera positioned in the editor? If it is not at (0,0,0) in world coordinates, it may be the cause of this offset issue.

Best,

El

---

<div class="post-metadata">

**Author:** ![paul.parkinson](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@paul.parkinson](https://forum.magicleap.cloud/u/paul.parkinson)\
**Post date:** [June 24, 2024, 8:13pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/7 "2024-06-24T20:13:42Z")

</div>

I have the same issue... stuck in the "_Look at the marker_ " phase, "Magic Leap" Plugin-in Provider only showed up after manually adding com.unity.xr.magicleap to the project, but even worse in my case, after I did this, the iPhone app could no longer find my ML ('s IP). I'm just using the spectator example app/scene. Not sure how anyone is getting this to work just by following [https://www.magicleap.care/hc/en-us/articles/22350469887117-Magic-Leap-Spectator-User-Guide](https://www.magicleap.care/hc/en-us/articles/22350469887117-Magic-Leap-Spectator-User-Guide) ? Thanks for any help...

---

<div class="post-metadata">

**Author:** ![tyler.morris](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@tyler.morris](https://forum.magicleap.cloud/u/tyler.morris)\
**Post date:** [June 25, 2024, 6:03pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/8 "2024-06-25T18:03:42Z")

</div>

I am also experiencing this issue. There seems to be some sort of conflict between the Magic Leap Package and OpenXR. Currently, having both enabled crashes the app with no error.

Does this mean Spectator is currently incompatible with certain OpenXR features?

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [July 9, 2024, 4:36pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/9 "2024-07-09T16:36:37Z")

</div>

We recommend updating to the latest version of the Magic Leap Spectator package, disabling the Magic Leap XR Plugin provider and only keeping the OpenXR / Magic Leap provider enabled.

Then in the OpenXR Features, select the settings icon next to Magic Leap 2 Support. Then enable **Perception Snapshots**.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/e/e7038ba65b7c12ea39e60b6e6331d0e3090d19c7.png)

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [July 26, 2024, 8:06pm UTC](https://forum.magicleap.cloud/t/ml-spectator-is-not-working-with-openxr/3582/10 "2024-07-26T20:06:47Z")

</div>

Closed on July 26, 2024, 8:06pm UTC


