# Eye tracking and Image Tracking in ml2

**URL:** <https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175>\
**Category:** Unity Development\
**Tags:** eye-tracking\
**Created:** [September 7, 2024, 12:49am UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175 "2024-09-07T00:49:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![iustinaiosub](https://avatars.discourse-cdn.com/v4/letter/i/ce7236/32.png) [@iustinaiosub](https://forum.magicleap.cloud/u/iustinaiosub)\
**Post date:** [September 7, 2024, 12:49am UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/1 "2024-09-07T00:49:01Z")

</div>

**Unity Editor version** : 2022.3.44f1  
**ML2 OS version** :1.9.0

I have a project where both eye tracking and image tracking are needed, however I could make the eye tracking work perfectly with openXR, while the image tracking is working well with MLSDK. Is there a way to make them both work as intended?

---

<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:** [September 7, 2024, 12:53am UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/2 "2024-09-07T00:53:27Z")

</div>

You cannot obtain input from both OpenXR and MLSDK at the same time. The input devices / subsystems are managed through unity depending on the XR Loader.

If you need to use the MLSDK , you can checkout the MLSDK samples by downloading the Magic Leap Unity Examples v 1.12.0.

When you say “image tracking” are you referring to marker tracking?

---

<div class="post-metadata">

**Author:** ![iustinaiosub](https://avatars.discourse-cdn.com/v4/letter/i/ce7236/32.png) [@iustinaiosub](https://forum.magicleap.cloud/u/iustinaiosub)\
**Post date:** [September 8, 2024, 9:54pm UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/3 "2024-09-08T21:54:40Z")

</div>

Thanks for the reply. And no, I need to recognise images, and for this I used Vuforia, which worked great. However, that is only working with MLSDK. And for the same project I need eye tracking as well. In consequence, is there a way to make the eye tracking work with MLSDK as well, as it has only worked with OpenXR for me.

---

<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:** [September 9, 2024, 4:40pm UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/4 "2024-09-09T16:40:46Z")

</div>

Thank you for that additional information.

Have you looked at the version 1.12.0 of the Magic Leap 2 Unity examples project. This project includes an eye tracking scene.

You can also see the MLSDK eye tracking documentation from our developer portal here:

> **[API Overview | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/input/eye-tracking/eye-tracking-api-overview/)**
>
> Magic Leap's Eye Tracking data is retrieved in two ways.

---

<div class="post-metadata">

**Author:** ![iustinaiosub](https://avatars.discourse-cdn.com/v4/letter/i/ce7236/32.png) [@iustinaiosub](https://forum.magicleap.cloud/u/iustinaiosub)\
**Post date:** [September 9, 2024, 10:03pm UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/5 "2024-09-09T22:03:25Z")

</div>

I did look at the example, however it is also using OpenXR. And when I try to access the libraries suggested for MLSDK for eye tracking from the documentation, it seems they are not recognized.  
That is why I'm confused whether I'm missing some other plugin maybe.

---

<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:** [September 9, 2024, 10:15pm UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/6 "2024-09-09T22:15:49Z")

</div>

Please make sure to use the the older version of the examples. The older example project is pre-configured for MLSDK

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

Note, after version 1.12.0 the updates to the SDK were for OpenXR functionality. If you do choose to upgrade the SDK, make sure to re-install the `com.unity.xr.magicleap` package from the package manager and enable the Magic Leap XR Loader from the XR Plug-in management window inside your Project's Settings.

---

<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:** [September 9, 2024, 10:19pm UTC](https://forum.magicleap.cloud/t/eye-tracking-and-image-tracking-in-ml2/4175/7 "2024-09-09T22:19:15Z")

</div>

You will need to add `using UnityEngine.XR.MagicLeap;` and `using UnityEngine.XR;` to the top of your script to access functions like:

```auto
InputSubsystem.Extensions.MLEyes.StartTracking();

```

and

```csharp
if (!eyesDevice.isValid)
{
    this.eyesDevice = InputSubsystem.Utils.FindMagicLeapDevice(InputDeviceCharacteristics.EyeTracking | InputDeviceCharacteristics.TrackedDevice);
}

```
