Search Unity

TextMeshPro and TextMesh are invisible in Game view.

Discussion in 'UGUI & TextMesh Pro' started by illinar, Feb 1, 2019.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    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

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

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    863
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    15
    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.
     
    MarcSpraragen likes this.
  8. andrescuevas

    andrescuevas

    Joined:
    Apr 23, 2019
    Posts:
    24
    Hello Ive seen many posts about this. But I keep getting the same problem even though i dont even have any textmeshprogui elements in my game. I tried changing the material anyway...Is it because Im using URP? empty text unity.PNG
     
    WinterboltGames likes this.
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    It is possible the issue is related to URP.

    Are you able to reliably reproduce the behavior? If so please submit a bug report with project and steps for use to reproduce. Once you have the Case # please provide it here in this thread.
     
  10. andrescuevas

    andrescuevas

    Joined:
    Apr 23, 2019
    Posts:
    24
    hello I am sorry, it was a silly mistake: color is rgba and alfa in inspector color picker is set to 0 by default... thats why textmesh pro object was invisible when instantiated with custom color picked in inspector with alfa not changed from 0. ahhhhh :/
     
    STechUnity likes this.
  11. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    I'm still getting this extremely frustrating issue in 2021.2

    @Stephan_B can you please look into this?
     
  12. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    Yes, to no one's surprise it happens because of the godforsaken URP.

    I made a test project with the legacy render pipeline and the text renders fine.

    I switched the test project to URP and the text disappears.
     
    RemDust and schlista like this.
  13. NickB27

    NickB27

    Joined:
    May 11, 2020
    Posts:
    5
    This is way late to the game....but also make sure that Transparent Layer Mask in your Renderer setting includes the layer your text mesh is set to. If it's not the text mesh will be invisible.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      50.6 KB
      Views:
      21
    WinterboltGames and xucian like this.