Search code examples
c#unity-game-enginehololensmrtkwindows-mixed-reality

Dropdown menu in MRTK3


Is it possible to make the Unity3D dropdown menu work in combination with the MRTK3 so that is interactable on the HL2? If so, how? In MRTK2 it was possible by attaching a script to the dropdown object.


Solution

  • Yes, it’s possible to interact with Unity’s built-in elements using MRTK 3. To do this, you need to add a new component called the Tracked Device Graphic Raycaster to the canvas. This component lets you use 3D tracked devices to highlight and select UI elements in that canvas. Please note that the Render Mode in Canvas should be set to World Space. For more details, you can refer to https://docs.unity3d.com/Packages/[email protected]/manual/ui-setup.html.

    This new component is contained from Unity XR Interactable Toolkit(XRI), and most interaction and input features in MRTK 3 are simply inherited from XRI. If you are new to XRI, I recommend you starting with Unity’s XRI architecture documentation. All XRI documentation also applies to MRTK 3.

    Here are some links that will help you understand the interactions in MRTK 3 :

    Migration guide from MRTK2 to MRTK3 - MRTK3 | Microsoft Learn

    Interactor architecture - MRTK3 | Microsoft Learn

    Interactables - MRTK3 | Microsoft Learn