Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

TextMeshPro UI disappearing when building to mobile device?

Discussion in 'Unity UI (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:

  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,049
    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

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,049
    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.
     
  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!
     
    Stephan_B likes this.
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,049
    You are most welcome! :)