How Can I display Hello World Text On my Hologram app?

edited June 2016 in Questions And Answers

How Can I display Hello World Text On my Holographic app, this text "Hello World" need to displayed dynamically at runtime, for example this could be a twitter feed.

Best Answer

Answers

  • ContextVRContextVR ✭✭✭

    I would start looking into MVC/MMVM patterns and things like uGUI and Text Mesh Pro.

  • HoloSheepHoloSheep mod
    edited June 2016

    @ManojTalreja sounds like you are looking for Unity UI.

    Look at the create dropdown at the top of the Hierarchy pane.
    BUT.. there are a lot of weird issues that you will need to fuss with.

    If you add a text element, it will put it inside a canvas as a container.

    • set canvas render mode to World Space
    • zero out the position of the canvas.
    • adjust the canvas Scale values to be 0.01 for x, y, z
    • adjust the canvas to be in front of you by setting your z = 2
    • unfortunately text defaults to black and requires you to create a material for it
    • create new material, set its shader to GUI/Text Shader, give it your color of choice
    • assign that new material to the text objects material property

    Set the Text property of the text object to Hello World.

    To programmatically set the text property do something like:

    using UnityEngine.UI;
    
    Text myTextControl;
    
    GameObject temp = GameObject.Find("Text");
    myTextControl = temp.GetComponent<Text>();
    myTextControl.text = "different text";
    

    where "Text" is the name of the Text object in your Hierarchy.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • ContextVRContextVR ✭✭✭

    Default uGUI text is a good option for "Hello World" apps, but for production apps I would use a vector-based text plugin such as Text Mesh Pro, which is compatible with uGUI.

  • @HoloSheep said:
    @ManojTalreja sounds like you are looking for Unity UI.

    Look at the create dropdown at the top of the Hierarchy pane.
    BUT.. there are a lot of weird issues that you will need to fuss with.

    If you add a text element, it will put it inside a canvas as a container.

    • set canvas render mode to World Space
    • zero out the position of the canvas.

    @HoloSheep Hi there, I have exported the HoloToolikit-Unity package into a new blank Unity project, as well as a Canvas and Panel (in ScreenSpace-Camera mode and HoloLensCamera prefab as RenderCamera) but I cannot change the position of the Canvas. You say "zero out the position of the canvas" but mine is greyed out. What am I missing?

Sign In or Register to comment.