Search Unity

TextMeshPro and TextMesh are invisible in Game view.

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by illinar, Feb 1, 2019.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    560
    The Text UI component shows up fine, Text mesh, however, is invisible in the game view, and so is TextMeshPro, however, both are visible in the Scene view.

    The UI canvas is in overlay mode. The scene otherwise is empty.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Can you provide the steps to reproduce this?
     
  3. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    560
    Well..
    1. New Scene
    2. Create>UI>Button
    3. Replace Text with TextMesh or TMP
    It also seems to be rendering in the wrong order and constantly has that outline (idk if that's a gizmo or not).

    upload_2019-2-2_0-23-45.png

    Nothing in the Game view:
    upload_2019-2-2_0-24-46.png

    2018.3.0f2
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    The <TextMeshPro> component and <TextMesh> both use the Mesh Renderer which handles sorting differently than the Canvas system which uses the Scene Hierarchy to determine sorting. In addition, the Canvas system uses the CanvasRenderer.

    So if you are using the Canvas system, you should be using the <TextMeshProUGUI> text component located in the "Create - UI - TextMeshPro Text" menu. When using this text component, the text will render correctly with the Canvas.
     
  5. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    560
    I see, thank you. This is confusing because when you press AddComponent and start typing "TextM..." You get TextMesh and TextMeshPro first and it never occurs to you that this is not the right component for UI.

    Maybe the system should detect that the MeshRenderer added into a Canvas system and give a warning?

    Another confusing part is that is visible in SceneView, which gets you thinking that it works, and it must be a bug.

    Thanks again.
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    That is a good suggestion and I'll most certainly consider adding something like that when I have time as you are not the first user to run into this.
     
  7. Hootlook

    Hootlook

    Joined:
    Oct 27, 2018
    Posts:
    12
    Just wanted to put my own fix here, if you CAN see the text in the editor but NOT when you build the project chances are that you are stupid and put the TextMeshPro folder in a Editor folder thinking it made sense preventing it to compile with the game..

    Definatly not happened to me just getting the word out.