Search Unity

TextMesh Pro TMPro text is not visible on a device

Discussion in 'UGUI & TextMesh Pro' started by apocalypshuk, Feb 27, 2019.

  1. apocalypshuk

    apocalypshuk

    Joined:
    Feb 24, 2016
    Posts:
    3
    Hi guys, have a question about TextMeshPro. I've generated a custom SDF font and created few material presets. When I'm testing the game in unity editor - everything works fine, all texts are visible. But when I run the game on my OnePlus6 - texts which are using one particular material preset are not visible. Other texts, which are using the same font, but different materials works fine. When I added another one material - different preset become invisible on a device. So I think it's related to the resources loading time/order. By the way, all texts are visible on my other phone - MeizuU10. I'm using Unity 2018.3.6 and TMPro 1.3.0. Please, advise, I have no idea what I'm doing wrong.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,935
    Are you using a mixture of <TextMeshPro> and <TextMeshProUGUI> objects where these objects share the same material presets?
     
  3. apocalypshuk

    apocalypshuk

    Joined:
    Feb 24, 2016
    Posts:
    3
    Yes, one of the material presets is used both in TextMeshPro and TextMeshProUGUI components.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,935
    This behavior is the result of the Mesh Renderer which is used by the normal <TextMeshPro> component and the CanvasRenderer used by the <TextMeshProUGUI> objects fighting over the ZTest on the material.

    The solution is to have a separate set of Material Presets for Canvas objects and Mesh Renderer objects.
     
    Hoorza, almosr and apocalypshuk like this.
  5. apocalypshuk

    apocalypshuk

    Joined:
    Feb 24, 2016
    Posts:
    3
    Wow, now I got it. I'll do separate materials. Thank you very much!
     
    Stephan_B likes this.
  6. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    42
    @Stephan_B Hello. I have the same issue. I have only TextMeshProUGUI component but I have some WorldSpace canvas and some ScreenSpaceCanvas. Should i do separate materials for SS canvas and WS canvas ?

    using 2019.2.9f1 + Unity Cloud Build iOS + TMP 2.0.1

    (don't have the issue in Editor and in my android build)

    Thank you
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,935
    For testing and to help narrow down the potential source of the issue, I would most certainly test using a different set of Material Presets.
     
    Fangh likes this.
  8. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    42
    @Stephan_B
    I made a new fresh project with
    - only one camera
    - one canvas
    - one TextMeshProUGUI
    - I removed a lot of Packages. Only kept Package Manager, Unity UI, TextMeshPro & Visual Studio Code Editor
    - I created an iOS 11.0 build
    - Unity 2019.2.9f1
    - using Unity Cloud Build
    - using Very Low Quality settings (EDIT : I also tried with Ultra settings. Same issue.)

    The text do not show on my iOS 13 iPad

    Here is the github repo : https://github.com/Thomas-6freedom/TMPiOS
     

    Attached Files:

    Last edited: Oct 25, 2019
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,935
    In the project linked above, the TMP Essential Resources are not present. For these tests, did you import the TMP Essential Resources?

    If you did import the TMP Essential Resources, what TMP shader is assigned to the text object?
     
    Fangh likes this.
  10. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    42
    @Stephan_B WOW ! Thanks !! I did not realised it's not pushed !
    Look at my screenshot, it's in my project !

    I looked into my .gitignore and there is this line :
    https://github.com/Thomas-6freedom/TMPiOS/blob/master/.gitignore

    # TextMesh Pro files
    [Aa]ssets/TextMesh*Pro/


    I use the default GitHub Unity3D gitignore file from Github Desktop !
    I'vr created an issue on their repo : https://github.com/desktop/desktop/issues/8527

    Why did they do this ?!

    I will try again by commenting this line.

    (of course I use the default LiberationSans material)
     

    Attached Files:

    Last edited: Oct 25, 2019
  11. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    42
    Last edited: Oct 26, 2019
  12. Hoorza

    Hoorza

    Joined:
    May 8, 2016
    Posts:
    24
    Thanks @Stephan_B . This issue was a real headache for me. To makes things interesting my problem was that my android phone build was working just fine(Samsung phone). In the editor, game was fine as well. Only my tablet(Samsung tablet), was having an issue. One scene, TMPro would not render. After I have deleted non-UI TMPro gameObjects in the game, the UI text rendered again. Hope it helps others. Thanks
     
  13. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,935
    The above was likely related to having a mixture of <TextMeshPro> and <TextMeshProUGUI> objects that share the same material. Since the MeshRenderer used by <TextMeshPro> objects and the CanvasRenderer used by <TextMeshProUGUI> objects often have different ZTest requirements, you end up with a conflict where these two renderers are fighting / changing the ZTest on the material. This can result in text not being visible.

    The solution if you need to use a mixture of <TextMeshPro> and <TextMeshProUGUI> objects is to have a separate set of Material Presets for each renderer type.
     
    xjjon likes this.
unityunity