Search Unity

TextMeshPro font disappears in game-view in a specific area randomly

Discussion in 'UGUI & TextMesh Pro' started by Bwacky, Sep 19, 2021.

  1. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    205
    Example video to show what issue I am having : c6oskEZ4dj.mp4 - Dropbox
    Example image: 33srCRH.png (1102×686) (imgur.com)
    Scene view for the image: 8vRqz7I.png (862×179) (imgur.com)
    Corrupted text on button in game view: CiyV6zB.png (187×81) (imgur.com)


    Hello!

    I have a curious problem where my TMP text is hidden in a specific area, as if it was being suppressed by something despite there not being anything. It's always in the same spot on the left side of the screen in my world scene, and at the bottom of the screen in my character select screen.
    The text displays perfectly fine in SCENE view, only GAME view is broken. This happens to me in 2 different scenes.
    The video shows my World scene, the image my character selection where the issue appears in the bottom view with fonts missing on buttons.

    The worst thing is this is somewhat random behavior.

    The only fix is changing the aspect ratio or restarting the play mode. Nothing else helps. The only way for me to repro it is to restart the project, as in the first "run" of the game it always breaks. All subsequent runs happen at random, but most of the time it's perfectly fine afterwards. The first run is always 100% borked.


    Things I did:
    - various installs of TMP including preview packages and additional content;
    - made separate fonts for tmp/tmpugui as instructed by other threads;
    - tinkered with padding to no avail and various font settings;
    - tried out different fonts and making my own;
    - it is not caused by any object in the hierarchy, tried removing/hiding all one by one including their components;
    - not caused by any quality or URP game renderer setting;
    - not caused by any graphics settings;
    - no errors in the console;
    - all shaders and script compile perfectly fine;


    Unity version 2020.3 happening since the first release up till now.
    URP LTS. Classic UGUI.
    Not using the new Elements system.
    Didn't try in 2021, don't want to upgrade yet as no LTS.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you see if you get the same behavior without URP (ie. using the standard render pipeline)?

    In terms of the behavior it looks like some shader / material or potentially mask interfering with that object.

    Is there any mask component used on these objects?

    Can you post an image of the inspector of the text object and its parents so we can see their position in world space and scale?
     
  3. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    205
    Finally had some time to get back to it, sorry for the late reply.

    1. Can't go to standard, this is a 100gb project and there is no simple way to convert all this crap back to built-in now.

    2. I made sure it's not any sort of object, going as far as just removing objects/components one by one seeing what happens.

    3. As far as I can tell no mask components used on the objects, at all.

    4. Below are one by one screenies of the components from the root of the text all the way to the parent. They are similar to other components that work perfectly fine with no issues. Even when I move parents around or take a broken button/move to a working parent or the other way around, what's broken remains broken and the ones rendering fine never break.

    Structure: https://i.imgur.com/v2CVSIJ.png

    1: https://i.imgur.com/8KvSF08.png
    2: czHyFf7.png (432×957) (imgur.com)
    3: IngDjpo.png (432×957) (imgur.com)
    4: 3dzgRxV.png (432×957) (imgur.com)

    5. The moment I as much as "check out" (using PlasticSCM) or click absolutely anything in the material, the font pops back in and works like a charm in game view. I am pretty sure this is something rooted deep into TMP shader behavior.


    ALSO:
    Something that seemingly seems to be causing it is using Free Aspect or Full HD in the ratio picker. When I select and stick to a hard 16:9, I seem to never have this issue happen anymore. Hence why I believe it's just a bug in TMP.
     
  4. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    205
    BUMP: After a good week of no issues when sticking to 16:9 aspect ratio, the problem just popped up with it. So in the end changing the ratio run-time fixes it, same as touching the material in run-time fixes it. No idea what could be causing it, I'm at wits end.
     
  5. ExcaliburGames

    ExcaliburGames

    Joined:
    Oct 29, 2013
    Posts:
    50
    Hi
    I had the same problem, but only on mobile devices (in editor everything was ok).
    After upgrading TMP from 3.0.6 to 3.2.0-pre.2 problem gone.
     
  6. ludzeller

    ludzeller

    Joined:
    Nov 11, 2016
    Posts:
    8
    Hi, same / similar problem here, but with the vanilla TextMesh, non-Pro. Could it be a shading, render queue thing? I had that problem also with the standard render pipeline, but was able to fix it with a render queue of 5000 (which is a bit weird, since it's actually meant to be non-GUI text that can be occluded by other geometry, and that occlusion was still working) for the GUI/3DTextShader that I am using.

    Now I am on URP, still using that shader (as there apparently is no URP-flavoured text shader, right?), but the problem is back.
     
  7. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    205
    I fixed it by doing something incredibly dumb and it should not be considered a valid fix, but I had no issue since.
    I moved the stupid text element forward.

    I believe the Z axis. Went from 0 to 0.01 in position, so the text draws now on top of backgrounds and it no longer disappears. Stupid, but it works. Had to do this for all my text objects. Should work the same for Vanilla TM.