Is it possible to create UI element with Unity's UI Toolkit for Hololens 2?

Anonymous
2022-02-24T18:57:17.29+00:00

Hi,

In my project, I have created UI elements with the UI Toolkit from Unity.

Now I want to get this working on the Hololens 2.
However, when I run it, the UI elements are not visible.
But in Unity you can see them in the player view and everything works fine.

HoloLens Development
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Hernando Ren 2,171 Reputation points
    2022-02-25T06:22:59.763+00:00

    Hello, Welcome to Microsoft Q&A,

    To make the UI elements under the Unity Canvas work on the HoloLens, please follow these steps:

    1. Select Canvas object in your scene, then in the Inspector panel for your Canvas, click "Convert to MRTK Canvas"
    2. Click "Add NearInteractionTouchableUnityUI"
    3. Set the Rect Transform component's X, Y, and Z scale to 0.001

    If you're new to MRTK or Mixed Reality development in Unity, we recommend you start with this doc: What is the Mixed Reality Toolkit

    ----
    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.