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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Textmesh Pro disappear during gameplay

Discussion in 'UGUI & TextMesh Pro' started by MarceloSabadini, Jun 20, 2018.

  1. Superjayjay


    Mar 28, 2013
    Unfortunately that was one of the first things I tried but it didn't change anything. I just checked again to see if I missed any but everything seems to be in order as far as having different material presets is concerned. I also tried duplicating Font Assets and using those, still no luck.

    The text elements aren't the only ones that are bugged either, I have a few images with materials assigned to them that aren't being rendered at all either. I also used the SuperText asset and its text objects are not rendering either.
  2. Stephan_B


    Unity Technologies

    Feb 26, 2017
    Are you using any AssetStore asset that might be trying to batch meshes together or something similar?

    Can you submit a bug report with the project and steps to reproduce so we can take a closer look?
  3. niki_kyl


    Dec 15, 2016
    We had a similar issue, somehow clicking the "Extra Padding" to true solved the issue. Not sure if it works for everyone but worth a try.
  4. Tom163


    Nov 30, 2007
  5. samanabo


    Mar 10, 2015
    We are also experiencing the issue where text will not display if sharing a material preset between TextMeshProUGUI and TextMeshPro components.
    This is made especially confusing when used in conjunction with localization, where a fallback font may be automatically selected. As far as I know there isn't a great way to set a specific fallback materials for a particular text object.
    This inadvertently causes the same material preset to be selected for both kinds of text objects, causing this issue to appear again, depending on the language selected in the game.

    Very interested in any working solutions, or if there are any plans to update or fix this functionality.
  6. Stephan_B


    Unity Technologies

    Feb 26, 2017
    See if you get the same behavior when using the latest preview release of the TMP package which is version 2.2.0-preview.3 for Unity 2019.4 or version 3.2.0-pre.3 for Unity 2020.3 or newer.
    samanabo likes this.
  7. ENOSI_Studio


    Sep 13, 2020
    Change the shader of the material for TMP/Mobile/Bitmap
  8. samanabo


    Mar 10, 2015
    Yes I believe that has fixed the problem for me!

    I am seeing a minor issue still but it seems to only affect the editor (and is not present in builds): World-space text will disappear when the center/pivot of the object goes off screen. My best guess is an issue calculating the bounding box for rendering? The text will reappear once the center of the object is back on screen. However, as you move around and text approaches the edges of the screen you will get a noticeable "flickering". This only appears to happen for text objects that do not have a separate world space material)
    I'm using Unity 2019.4.34f1 and TMP 2.2.0-preview.3

    Again this appears to only occur in the editor so for my purposes it is not a deal breaker.
    Thanks for addressing this!

    Text on the right is visible, since the center of the object is on screen:

    Text on the right is invisible, since center of object is slightly off screen
  9. poprev-3d


    Apr 12, 2019
    Alright I think I found the issue and how to fix it temporarily until the latest TMP beta (which solves the issue for me) is officially released and stable. I only have this issue in WebGL builds.

    When you have TextMeshPro_UGUI elements in you scene (which are screen space elements), and then programmatically add a TextMeshPro element (which is a world space object) in the scene afterwards, you end up messing the default Material because it is used by both. For some reason, the default material is assigned to the TextMeshPro element and some properties of the default material are changed in a way that it works world space but cannot work screen space anymore.

    One easy way to fix this is to clone the default material at the beginning and then each time you add a TextMeshPro element, restoring the properties of the default material with CopyPropertiesFromMaterial:

    Code (CSharp):
    2.     // The default material preset (which can be found under you default font asset)
    3.     // Assign it in the editor
    4.     [SerializeField]
    5.     Material defaultMaterialPreset;
    7.     Material defaultMaterialClone;
    8.     Material worldSpaceMaterial;
    10.     private void Start()
    11.     {
    12.         // Store a clone of the default material to gather its properties later
    13.         defaultMaterialClone = Instantiate(defaultMaterialPreset);
    15.         // Also create a copy of this material to assign it to any created TextMeshPro elements
    16.         worldSpaceMaterial = Instantiate(defaultMaterialPreset);
    17.     }
    19.     private void AddWorldSpaceText()
    20.     {
    21.         GameObject textContainer = new GameObject("Text container test");
    22.         TextMeshPro worldSpaceText = textContainer.AddComponent<TextMeshPro>();
    23.         worldSpaceText.SetText("coucou");
    24.         worldSpaceText.transform.position =;
    25.         worldSpaceText.enableAutoSizing = true;
    26.         worldSpaceText.fontSharedMaterial = worldSpaceMaterial;
    28.         // Make sure you restore the properties of the default material from the clone you made in start
    29.         defaultMaterialPreset.CopyPropertiesFromMaterial(defaultMaterialClone);
    30.     }
    This code has the advantage of working on all existing TextMeshPro_UGUI elements (existing and those who will be created later), instead of having to change their material manually.

    Although this is a quickfix, it would be ideal if we could set a different default material for world space / screen space TMP elements.
  10. JerbearGames1004


    Dec 20, 2021
    Recently just wasted an hour trying to figure out my similar problem. turned out my TextMeshPro was disappearing simply because the scale.z of its parent was being set to 0 due to assigning it as a * value. this was fine when i was using only canvas based things but it will invis any non canvas mesh obviously.

    if anyone is having this issue, be sure to check all transforms including the entire parent heirarchy for the scale.z during runtime :)
  11. DreamcatcherProduciton


    Sep 29, 2016
    That may have been the fix in your case, but it is still an issue on my end, there's no 0 scale on Z.


    (WebGL build)
  12. doctorfunfrock1


    Oct 5, 2014
    @Stephan_B Can you please confirm that this is fixed in the 3.2 prerelease 4 for Unity 2021?
    (I have a ton of fonts for 16 languages and I dynamically switch between them. It would be a pain to create and maintain duplicate material presets.)

    EDIT: as a final note, the manual update to the above mentioned version seems to have fixed it for me (at least no complaints in ~200k android downloads over the last two months)
    Last edited: Apr 24, 2023
  13. AlexStrook


    Oct 19, 2013
    2020.3.21f + URP

    I had the issue of disappering text and UI, I've been tring to fix it for weeks on my project...Turns out creating and applying a specific material preset for the TextmeshPro objects in the scene (3D texts, not Canvas Texts) fixed the issue!

    This worked for me, and thanksfully those 3D texts always have the same font because they aren't translated. I have custom fonts fallbacks for some languages, it would have been a pain to make system that switch the material for specific preset when changing languages...
  14. jlarata


    Feb 10, 2023
    this made it for me, after some hours of poor diagnostic of my problem

    thanks Stephan, i hope good things happen to you.