# How do I detect it is ML2 by code?

**URL:** <https://forum.magicleap.cloud/t/how-do-i-detect-it-is-ml2-by-code/1558>\
**Category:** Unity Development\
**Created:** [March 7, 2023, 7:02pm UTC](https://forum.magicleap.cloud/t/how-do-i-detect-it-is-ml2-by-code/1558 "2023-03-07T19:02:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rick](https://forum.magicleap.cloud/u/rick)\
**Post date:** [March 7, 2023, 7:02pm UTC](https://forum.magicleap.cloud/t/how-do-i-detect-it-is-ml2-by-code/1558/1 "2023-03-07T19:02:54Z")

</div>

This may be a dumb question. How do I know I am running on a ML2 device in Unity? Apparently it is Android runtime. Is there a Macro define that distinguishes ML2 from other Android devices?

---

<div class="post-metadata">

**Author:** ![dhartley](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@dhartley](https://forum.magicleap.cloud/u/dhartley)\
**Post date:** [March 8, 2023, 6:01pm UTC](https://forum.magicleap.cloud/t/how-do-i-detect-it-is-ml2-by-code/1558/2 "2023-03-08T18:01:22Z")

</div>

Magic leap provides a section in their guides to help with this issue. Here is the link and hope this helps:

[https://developer-docs.magicleap.cloud/docs/guides/unity/detect-target-platform/platform-detection-overview](https://developer-docs.magicleap.cloud/docs/guides/unity/detect-target-platform/platform-detection-overview)

---

<div class="post-metadata">

**Author:** ![kdowney](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kdowney/32/481_2.png) [@kdowney](https://forum.magicleap.cloud/u/kdowney)\
**Post date:** [March 8, 2023, 6:16pm UTC](https://forum.magicleap.cloud/t/how-do-i-detect-it-is-ml2-by-code/1558/3 "2023-03-08T18:16:12Z")

</div>

Thank you @dhartley ^

@rick if you just want a simple condition based on current hardware, you can read `SystemInfo.deviceName` which will return `Magic Leap 2`
