Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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

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

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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.
     
  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:
    281
    @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

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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:
    281
    @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

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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:
    281
    @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:
    281
    Last edited: Oct 26, 2019
  12. Hoorza

    Hoorza

    Joined:
    May 8, 2016
    Posts:
    49
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    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.
     
    ilmario, Full_Tilt and xjjon like this.
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just to confirm this issue only occurs in the build?

    Is this a Desktop build and if not what platform?

    Any chance you can submit a bug report with project? If you do, please provide the case # once you have it.
     
    BeorGames likes this.
  15. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    65
    Hello Stephan, thank you for your help, at the end it didn't have anything to do with the TMP asset, it was something related to the Localization package, I found the error, thanks for your help.
     
  16. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just for anyone else running into this, what was the issue with the Localization Package?

    How did you resolve this?
     
  17. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    65
    Oh, I had to build the Adressable again, I thought it had to be done only once, not every time I add new text to the game, so it wasn't showing anything because it tried to translate the text and couldn't find it, so it returned an empty string, found it adding a debug.log on the translation returned and running it on adb logcat, because on the PC it was working fine.
     
  18. planetfactory

    planetfactory

    Joined:
    May 18, 2016
    Posts:
    57
    Hi, I can confirm that this still happens with Unity version 2021.3.X
    using separated materials fixed the issue, but I think that is something that should be fixed on the Unity side...
     
    DavidZobrist likes this.
  19. xiexiexiexiexie

    xiexiexiexiexie

    Joined:
    Jun 1, 2021
    Posts:
    2
    Hi,@Stephan_B I wonder Why does this issue only occur on the device and not in the editor?
    Under what circumstances does this issue occur?In my case, within the same scene, both TextMeshPro and TextMeshProUI display correctly, but the TextMeshProUI under the "DondistoryOnload" node is not showing up. (They are all using the same material)
     
    Last edited: Jul 25, 2023
    User_1228 likes this.