Search Unity

TextMeshPro UI disappearing when building to mobile device?

Discussion in 'UGUI & TextMesh Pro' started by SuperstarAlex, Jan 16, 2019.

  1. SuperstarAlex

    SuperstarAlex

    Joined:
    Jan 16, 2019
    Posts:
    3
    Hey everyone,

    I am building a mobile game and also using TextMeshPro, but I've encountered a very strange issue that I currently cannot seem to fix no matter what I do, I've spent hours and hours trying to fix this and it is also frustrating having to make a build to mobile each time to check if it has been fixed.

    The UI is fine in the Editor, but suddenly disappears when I build and test it on mobile (Android) - and it's not just my Android device, I have tested it on multiple other Android, as well as iOS, devices and the issue remains the same.

    I've attached two images to show the bug I am describing.

    I remember reading up somewhere else about creating material presets to have separate materials for TextMeshProUGUI and TextMeshPro scripts, as the issue can be caused if both are being used in the same scene - but that hasn't fixed it either.

    One thing I should also mention is that this issue does not occur in all my scenes, only in specific scenes, though I am unsure of the reason why.

    Does anyone have any idea on what the issue could be?

    Thanks in advance.

    - Alex
     

    Attached Files:

    makaka-org and yehielc like this.
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using the same font assets in the scenes where this issue does not occur? If you are not see if using a different font asset in the problematic scenes changes the behavior.

    In the scenes where everything works as expected, are you also using a combination of <TextMeshPro> and <TextMeshProUGUI> or still both?

    In your own code, and in the scene where the issue occurs, are you using anything like GUI.Enable = false;?
     
  3. SuperstarAlex

    SuperstarAlex

    Joined:
    Jan 16, 2019
    Posts:
    3
    Hi Stephan_B,

    Thanks for the reply!

    Yes, I am using the same font assets in the scenes where this issue does not occur so I have assumed that that might not be the issue (though I am still not 100% sure).

    For some scenes where everything works as expected, I am also using a combination of <TextMeshPro> and <TextMeshProUGUI> and there does not seem to be an issue - which I am finding very strange and have started to assume this might not be the issue too.

    Nowhere in my code am I using anything like GUI.Enable = false;

    Do let me know if there's anything else you think could be the cause and if there's anything you'd like me to test!

    Really sorry if the information I provided is not useful in finding the issue so far!
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Most likely the issue comes from using a combination of normal <TextMeshPro> and <TextMeshProUGUI> object that share the same material preset.

    Test #1: Use a different font asset on the object that doesn't render correctly. If the text object renders correctly,

    Test #2: Use a different Material Preset (created from the Font Asset / Material that was having the issue) and see if the text now renders correctly.
     
    makaka-org likes this.
  5. SuperstarAlex

    SuperstarAlex

    Joined:
    Jan 16, 2019
    Posts:
    3
    Test #1: I tried using a different font asset on the objects that didn't render correctly and it did render correctly!

    Test #2: The other material presets still weren't working, so I decided to create a completely new Material Preset from the Font Asset / Material that was having the issue and the texts now render correctly!

    The issue is now solved, massive thanks again for all the help Stephan_B!
     
    makaka-org and Stephan_B like this.
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You are most welcome! :)
     
    makaka-org likes this.
  7. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,023
    Creating different material for World Space is also solution on Unity 2019.4.10, TextMesh Pro 2.1.3 and Android 10
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Curious about the reference to Android 10.

    Are you seeing a different behavior in this regard between Android 10 and previous versions of Android?
     
  9. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,023
    Oh, I had not tests on other Android versions, I have the only android-device: Samsung Galaxy A71, if it makes sense.

    So I have about 10 canvases with screen space texts and the only world space text. So on some canvases texts are disappeared when I added this world space text.
     
  10. Robdon

    Robdon

    Joined:
    Jan 10, 2014
    Posts:
    141
    I think I've had a similar issue to this, but I can't quite tell. But thought I would explain what happened to see if it helps.

    I've found a very specific situation, that is causing my text to blank out like others are explaining.

    1) Linux (Ubuntu). Works fine on Windows.
    2) A scene with both a Pro & a ProUGUI Gameobjects, using the same font/material.
    3) Not sure if Unity version matters but currently on (2018.4.23f1)
    4) The text goes blank when you change resolution from the default (mine is 1920x1080) to a new size with:
    Screen.SetResolution(1280, 720, true);

    Just that alone doesn't cause a problem for me, what happens (and I think is the 'problem') is if you also have a camera in the same scene and it has the 'Force Into RT' flag set (This flag is hidden and you need to use Debug to set it). Then it causes the text to blank when res changes.

    This flag is normally unset, but for some reason one of my cameras had this set. Apparently, there is/was a bug, when if you add post-processing to the camera, and then remove it... this flag gets left as 'set'.

    HTHs.
     
  11. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,023
    I noticed that when I modify texts then new string in .meta is added: _CullMode: 0. May be the deal was in this missing string?
     
  12. kureysalp

    kureysalp

    Joined:
    Oct 1, 2017
    Posts:
    10

    In 2018 someone else had this issue too and I am having today too. Why this is not fixed for 3 years. Why we have to separate materials. How can we know we should separate materials without looking forums.


    EDIT: Also I am using same preset on both UGUI and normal TMPRO but some of UGUI ones renders correctly but some of not. Also I am using template project on my projects so one of the UGUI that not render correctly is from template and that one had no problem with my previous projects. Also I was using both TMPRO on that previous project. There is a huge inconsistency going on.
     
  13. IAmChiagozie

    IAmChiagozie

    Joined:
    Jun 26, 2017
    Posts:
    38
    I have an issue where TextMeshProUGUI renders just fine in the editor and in some android phones, but there are some phones that has been reported that the text was missing.
     
  14. AliBuck

    AliBuck

    Joined:
    Aug 22, 2020
    Posts:
    30
    I had the same issue. Using different materials for the world and for the canvas solved it for me! Thanks a lot!

    Just one small thing. In my case fonts were rendered, however there were a lot of pixels missing.
     
  15. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    I am having the same issue with Unity 2021.3.6f1 TMP 3.0.6
     
  16. Nanachi88

    Nanachi88

    Joined:
    Aug 10, 2022
    Posts:
    14
    last week it was fine, now the font is gone.
     
  17. bab202

    bab202

    Joined:
    Oct 18, 2018
    Posts:
    15
    Thank you for addressing the issue, I recently face with this issue (Unity 2022.3.5) when i have both TextMeshPro & TextMeshProUGUI in a scene, this scene render ok but then when my game load to another scene the TextMeshProUGUI doesn't render (this issue only happen on the mobile device, not in the Editor). The solution is create new TextAsset for the object that doesn't render correctly.
     
    PlayIgames likes this.
  18. xiexiexiexiexie

    xiexiexiexiexie

    Joined:
    Jun 1, 2021
    Posts:
    2
    The problem I encountered is exactly the same as yours. Do you know the reason behind it? Why is this only happening on mobile phones? Why is it good before and not good after loading a new scene?
     
  19. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,086
    This is probably a side effect of how they "fixed" the recent scaling issues with RectTransform and Canvases.
     
  20. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    I have same problem please help me