Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Some TMPs disappear on Android after orientation changes

Discussion in 'UGUI & TextMesh Pro' started by Logopolis, Sep 3, 2018.

  1. Logopolis

    Logopolis

    Joined:
    Feb 18, 2015
    Posts:
    27
    Hello,

    For several months some of my players have been running into a problem on Android (specifically Google Pixel 2), where after the first time the game's screen orientation changes, some TextMeshPro text elements no longer appear.

    In the attached screenshot, some buttons are missing their text after an orientation change. Most of the text that is still visible uses Unity's Text element. But a few of the TextMeshPro elements remain visible for some reason; for example see the text on the six buttons at the very bottom of the screen. Only the one in the lower right has disappeared, even though they are all functionally alike.

    I'm using Unity 2018.2 and TMP 1.2.2.

    Any idea why this may be happening?

    Thanks in advance!

     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Are you able to reproduce this on other devices or does this only happen on the Google Pixel 2?

    Are you using a mixture of normal <TextMeshPro> objects along with <TextMeshProUGUI> text objects where some of these might happen to share the same materials?
     
  3. Logopolis

    Logopolis

    Joined:
    Feb 18, 2015
    Posts:
    27
    Hi Stephan_B -- that turned out to be exactly the problem! There were <TextMeshPro> objects as well as <TextMeshProUGUI> objects, and they shared the same material. Interestingly, the <TextMeshPro> were no longer being used (because they had been disappearing on all platforms, so I replaced them with TextMesh objects) and so those components were inactive, but they caused the problem to appear on the Google Pixel 2 anyway. Once those inactive <TextMeshPro> components (along with their MeshRenderers) were deleted, all <TextMeshProUGUI> objects now appeared as they should. Thank you!
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Since that was the issue, you can resume using a mixture of <TextMeshPro> and <TextMeshProUGUI> object but you simply have to use a different set of materials presets for the MeshRenderer and for the Canvas Renderer.

    The reason for this is because the Mesh Renderer and Canvas System both fight over the ZTest on the Material. So they each change it and depending on who changed the ZTest last, can make some objects disappear.