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

Question TMP characters disappear when screen size is changed in Google Chrome

Discussion in 'Web' started by unitsume, Aug 16, 2023.

  1. unitsume

    unitsume

    Joined:
    Oct 7, 2022
    Posts:
    31
    Hello.
    I'm creating a WebGL built application.
    If you display it in Google Chrome and change the screen size, the characters of TMP will disappear.
    This phenomenon does not occur in FireFox.
    How should I deal with this phenomenon?

    If you don't have enough information to answer, please contact us.
    thank you.
     
  2. rubeng

    rubeng

    Joined:
    Apr 20, 2013
    Posts:
    58
    This is also happening to us, we are using 2022.3.5f1 and TextMeshPro 3.0.6
    In our testing we see difference in behaviour in our main menu and ingame, the problem doesn't seem to happen in the main menu, but I have no clue what could be the difference that triggers the issue ingame.

    Thanks for any information
     
  3. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    842
    Did you set your canvas to resize?
     
  4. rubeng

    rubeng

    Joined:
    Apr 20, 2013
    Posts:
    58
    This is the config that I have in the canvas

    upload_2023-8-17_16-19-30.png

    and ingame we also have a temporal scaling that allowed us to resize all of our ingame ui (we wanted everything a % smaller without big prefab changes, and allowing us to adjust that per platform)

    Code (CSharp):
    1. public class CanvasGlobalScaler : MonoBehaviour
    2.     {
    3.         public List<CanvasScaler> canvasScalers;
    4.         public void Awake()
    5.         {
    6.             var factor = GlobalData.Instance.mainConfig.uiScaleFactor;
    7.             foreach (var canvasScaler in canvasScalers)
    8.             {
    9.                 var a = canvasScaler.referenceResolution;
    10.                 canvasScaler.referenceResolution = (double)Mathf.Round(canvasScaler.matchWidthOrHeight) != 0.0 ? Vector2.Scale(a, new Vector2(1f, factor)) : Vector2.Scale(a, new Vector2(factor, 1f));
    11.             }
    12.             Canvas.ForceUpdateCanvases();
    13.         }
    14.     }
    everything else in those canvases looks perfect, only the textmeshpro labels dissapear
     
  5. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    842
    hm, mine are OK as long as I set the anchors OK.. if I mess that up they go walk about but otherwise never had issues..
     
  6. rubeng

    rubeng

    Joined:
    Apr 20, 2013
    Posts:
    58
    Do you have any more information with this? I am trying to replicate it in a separate project, but there it works just fine.
    I can't imagine what is different here.

    Another weird thing that I tried is using https://github.com/yasirkula/UnityRuntimeInspector to setup a way to check if anything was obviously wrong, and when I try to inspect the TMP component that became invisible, it reappears, but if I change anything it dissapears again.

     
  7. rubeng

    rubeng

    Joined:
    Apr 20, 2013
    Posts:
    58
    I crossposted the thread in the tmp/ugui forum, to see if anyone there has an idea.
     
  8. JolanHuyvaertDieKeure

    JolanHuyvaertDieKeure

    Joined:
    Mar 1, 2021
    Posts:
    9
    We also have TMP text disappearing in WebGL builds when going to full screen. It only happens in Chromium based browsers (Chrome & Edge) on Windows (tested on Windows 10). Chrome on Android, Chromebook and on iOS are fine.
    We use Unity 2022.3.0 at the moment, but we had this happening in the previous LTS (2021.3) as well. My colleague did an extensive effort to try to repro the issue and find possible fixes/workarounds. I will ask him to share his findings here as well.
     
    MargotDeSaegher, rubeng and jhuyvaert like this.
  9. Arne_VdB

    Arne_VdB

    Joined:
    Oct 7, 2019
    Posts:
    1
    Temporary fix I have discovered:

    => Duplicate the affected font
    => Activate "Underlay" in the material and put alpha to 1.0 (or 0.0 seems to work as well)
    => Within the affected TMPro component, assign this newly created font.

    This is no guarantee the bug is gone forever, it is possible the font gets "infected" again,
    but at least there is text in specific builds.

    I have tested this on two different occasions now and this seems to work consistently.
     
    MargotDeSaegher likes this.