Search code examples
c#unity-game-enginehololensmrtk

UI creation with MRTK (Usage of Slate)


I would have several questions for the community:

As a short version:
  1. Are there any tutorials on how to create 3D UIs in Unity. Primarily for the Hololens 2, for example with the MRTK toolkit?
  2. As an explicit question how can I create a scrollable text (TextMeshPro) with a slate prefab?

For Questions 1:

I have only recently started working with the Hololens 2. I also have not yet gathered much expert knowledge with creating UIs in Unity. I have noticed that the prefabs in MRTK are built differently than the typical Unity UIs (which I have seen in tutorials). As an example, no canvas but only rects are used. On the MRTK UX page the prefabs are shown but not how to create and arrange your own elements.

For Questions 2:

My detailed question now is about the MRTK Slate Prefab. I would like to display text that I add dynamically in a TextMeshPro on a slate (e.g. in the ContentQuad) and scroll it with interactions. Like on the smartphone via up/down swipe scrolling. In the prefab a mesh material as content is used (which is a png). So I can't pass the TextMeshPro or the rect directly. If I use the text material as mesh material and use a box collider the text is not readable and not scrollable. Is there a solution which i don't see? A similar question was asked here, but was not answered (I tried to ask the question different/more accurately though).


Solution

  • As a person who has used a lot of UI slates for Hololesn 2 and 1 over the past 2 years, I can try to help you with it.

    Q1:

    None that I know of. They have provided detailed instructions on how to make a Button with all the elements from scratch here. I am not sure you are right. They also use canvas elements too especially where the texts need to be visible.

    Q2:

    I can give a direct solution here. I have edited the UGUI slate from MRTK so that there are only Text mesh pro components and scroll view. You can download the prefab and start using it. Here is the link.

    I would suggest playing around with the slate and trying to add and remove components and see how it affects the slate. It will then make sense to you.

    Hopefully, this helps.