Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro TextMesh Pro text not rendering in iOS build

Discussion in 'UGUI & TextMesh Pro' started by mlansing, Jan 25, 2018.

  1. mlansing

    mlansing

    Joined:
    Jul 13, 2015
    Posts:
    4
    I have had this issue with a number of TMPro versions. In my iOS build any TMPro text objects do not render their text unless: 1. I rotate my phone, after that point all TMPro objects render text correctly. 2. The TMPro text object is a child of a scrollview container object. If I have a sprite within my TMPro text object, the sprite will render automatically, but not any text that is in-line with it. Has anyone else had this issue or have any suggestions? I am using the most recent, free version of TMPro.

    Edit: Solution from Stephan_B for those who don't want to pick through below:

    "The issue with the mixture of normal and UGUI text object comes from the Mesh Renderer and Canvas Renderer fighting over the ZTest on that material. They are both changing it to different settings which results in this behavior.

    Solution is to have a set of Material Presets for normal text objects and one for the Canvas objects. So two sets total.

    See the following thread."
     
    Last edited: Jul 3, 2018
  2. andgus

    andgus

    Joined:
    Oct 6, 2016
    Posts:
    10
    I have the same issue. Everything works fine in the Unity editor. In my IOS build every TMPro text render fine in the main menu until I start a new level. Then all text is gone! When returning to main menu this text is now also gone. It seems to happened with GUI text when change levels. 3d Text meshes works fine. I use the latest TMPro.
     
    conleymckown and igli15 like this.
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Any chance either of you can submit a bug report which includes a Repro Project? If you do submit a bug report please provide me with the case #.
     
    igli15 likes this.
  4. panhammer

    panhammer

    Joined:
    Jan 30, 2016
    Posts:
    1
    I have the same problem. Did anyone find a solution to this?
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I still need a Repro project / bug report on this as I am unable to reproduce it on my end. If you do submit a bug report with repro project please provide the case # here.
     
  6. mlansing

    mlansing

    Joined:
    Jul 13, 2015
    Posts:
    4
    The issue doesn't seem easily reproducible and resolved itself after I discarded TextMesh Pro, tried to implement my own text solution, was unhappy with the results, and added back the TMPro text component. However, a few months later (this week) I ended up with the same problem again. On a random build, after making no changes to prefabs that use TMPro, some stopped rendering text. After a day of trial and error, removing all of TMPro and re-importing it, I found a solution (I hope).

    Solution that works in my project:
    Add a mask component to the game object that holds the TMPro component. The font material then gets a "Masking ID:1" and text renders properly on iOS builds.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do you happen to be using a mixture of <TextMeshProUGUI> and normal <TextMeshPro> objects which share the same material preset? See the following thread.

    If you are using Dotween see the following thread as this could also produce a similar behavior.
     
  8. mlansing

    mlansing

    Joined:
    Jul 13, 2015
    Posts:
    4
    Thanks! That could be the case, looking through my project I use a few normal <TextMeshPro>, however, they are prefabs and when I'm having this issue they are not present in the scene. Does that make a difference? I'll work through the linked thread and make sure I have things setup correctly.
     
    Last edited: Jul 3, 2018
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The issue with the mixture of normal and UGUI text object comes from the Mesh Renderer and Canvas Renderer fighting over the ZTest on that material. They are both changing it to different settings which results in this behavior.

    Solution is to have a set of Material Presets for normal text objects and one for the Canvas objects. So two sets total.
     
  10. mlansing

    mlansing

    Joined:
    Jul 13, 2015
    Posts:
    4
    Thank you for your help! I think I have everything straightened out and working in my project now. I haven't updated to unity 2018 yet so I'm not sure if changes have been made, but I would suggest TMPro assign separate Material Presets for UGUI and regular TMPro Text by default when dropping in a TMPro component from the menu. I appreciate how active you are in the forums. Very, very helpful!
     
    Stephan_B likes this.
  11. walaber_entertainment

    walaber_entertainment

    Joined:
    Jul 10, 2017
    Posts:
    30
    Just popping in to say that I was having this same issue, and google search got me here to realize that I was mixing GUI and world-space text components with the same material preset. thanks for this thread!
     
    Stephan_B likes this.
  12. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    Hello to all. Is this also the solution for text showing as boxes? I'm using Unity 2019.3.9 and just got converted the project from 2017.2.23(legacy textMeshPro). After the conversion, some texts rendered as boxes and with iOS devices, texts are not showing. I've tried creating 2 Material presets but it is still happening.
     
  13. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    Sorry for asking, but what do you mean by World-space text?
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    A potential source of the text disappearing is the result of using a combination of <TextMeshPro> and <TextMeshProUGUI> text objects which shared the same font asset and material preset. See my previous posts above and links which explains why this can lead to issues and solution which is to simply use two different sets of material presets.
     
  15. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    Thanks for replying Stephan, I read the posts above and also created two sets of material presets for the font asset(as you can see in the screenshot I attached). Also, we don't use <TextMeshPro> within our project but only <TextMeshProUGUI>. I changed also the objects with <Text> to <TextMeshProUGUI> which are being changed within the Update() thinking that this might be the cause, but still, boxes are appearing at some time in the devices.
     

    Attached Files:

  16. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You mean that you originally were using UI Text objects <Text> which you have replaced by <TextMeshProUGUI> objects but are still running into the same issue?

    Text as pure white boxes might indicate the atlas texture is missing and replaced by white texture. If the boxes are grey'ish, then it is likely an SDF scale issue where the perhaps these text objects are being scaled.

    Which of the two potential types of white boxes are you seeing?

    Are you doing any type of scaling on the text object or its parents?

    P.S. Which Shader are you using on those text objects? See if you get the same behavior with the Mobile distance field. There are also two new shaders included in the TMP Essential Resources of the latest TMP package which is Preview 10. These have SSD at the end of their name. There is a full version of the SSD and a mobile version. See if you get the same behavior with those?
     
    Last edited: Apr 22, 2020
  17. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    Not all texts, but only that specific text object that was being updated with Update was changed from <Text> to <TextMeshPro> but this was not the one having boxes but a different object, I decided to changed that thinking that it might be the cause of it.

    I got both boxes(White/Gray) but not everytime, it also happened randomly and other case was text is not showing for iOS devices.

    Yes we do scaling (by LeanTween) but for the parent holder not directly the Text object. I tried to changed the shader to Mobile distance field from Distance Field, but the problem still showing.

    Preview 10 is still not showing in the Package Manager, is it gonna be available with Unity2019.3.9? or should I upgrade to Unity2019.3.10 to see the latest package?

    Is re-creating the Font Asset might be a solution considering that the atlas texture is missing on rendering?


    ****** UPDATE ******


    I tried to remove the scaling animation for the parent object and the texts rendered fine, but there should be another solution for this without removing of animation/scaling.
     
    Last edited: Apr 22, 2020
  18. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Knowing the issue is related to scaling is good.

    In order for the text to render correctly, the scale of the text object needs to be uniform. Ie. x, y, z of all the same value. Often when animating the scale, people leave Z at 0 which can cause issues.

    Using a scale of zero can cause issues. I would have to look at the specific animation but most often these issues can be avoided by using a scale of 0.0001f. Ie. very close to zero but not zero.

    Also, the shaders I referenced were new shaders with the label SSD as seen in the image below

    upload_2020-4-22_10-32-37.png

    The SSD shader doesn't use SDF Scale and instead uses Screen Space Derivatives (SSD). I wanted you to test that one to rule out scaling related issues which we know it is now.
     
  19. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    The problem has been fixed and yes, it was because of the scaling animation we have. Thank you Stephan_B for the fast replies especially giving the thought of having scaling might be the cause of it. I certainly didn't thought that it will affect the rendering of the texts (which doesn't happened in Legacy TextMeshPro). I'll be keeping your recommendation of using 0.0001f instead of zeros.


    Regarding the Distance Field SSD, It is not showing in my editor (Unity 2019.3.9f1) with TextMeshPro 2.0.1. I attached the screenshot of it.

    If ever it will be available, I'll try it.

    Thank you again for the help. Keep it up!
     

    Attached Files:

  20. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The SSD shaders were added in 2.1.0-preview.x. These are contained in the updated TMP Essential Resources.
     
  21. ABI16

    ABI16

    Joined:
    Mar 19, 2019
    Posts:
    16
    Nice! Looking forward to it. Thanks again Stephan_B.
     
  22. xodennisxo

    xodennisxo

    Joined:
    Mar 25, 2020
    Posts:
    24
    Hi Stephan,
    i got the problem that some certain texts in certain game screens displays incorrectly with some wierd dots(please check the screenshot, i don't know the accurate english words). and the problem only occurs on iOS(editor and android are fine)

    the above font size 100 words has the probme, and the below small text is just fine. and other chinese text in other places are fine.
    upload_2020-10-30_14-36-24.png
    the scale of the incorrect one is just the same as it's fine neighbor node(1, 1, 1)
     

    Attached Files:

  23. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This behavior could be the result of texture compression so make sure none is used on those font assets / atlas textures. Are you using any form of texture compression on iOS?

    If could also be due to the atlas textures having a different width and height. What is your atlas size?

    Other potential cause, might be material property values like Dilation, etc. exceeding the range of the padding value.

    This could also happen if Extra Padding is enabled in the text object Extra Settings along with a Ratio of Sampling Point Size to Padding that is pretty small like less than 2%. This would cause portions of the adjacent characters to be visible (ie those dots).

    I also recall a similar issue / post on the forum but can't recall the specific as it was perhaps 6 to 9 months ago. I'll do a quick search to see if I can find it.

    Let me know if any of these apply.
     
    Last edited: Oct 30, 2020
  24. xodennisxo

    xodennisxo

    Joined:
    Mar 25, 2020
    Posts:
    24
    we use ASTC4*4 for ios textures, and ETC2 for android. however, we're using TextMeshPro dynamic atlas population mode, the font assets/ atlas textures are dynamic generated by TMP, seems we don't have ways and we didn't intent to modify the compression of these font atlas textures.
    the size of atlas textures is 1024*1024. pading 9, sampling point size 90. with dilate 0 in material property. and extra padding is not enabled.
    till now we only notice the problem on iOS. And the issue could recover to normal sometimes by switching ui screens back and forth without reboot game or switching scenes.:(

    and seems we don't have the un-uniform scale and mixing TextMeshPro and TextMeshProUgui problems.

    we're using TMP 2.1.0 preview 12, Unity 2019.3.11
     
  25. xodennisxo

    xodennisxo

    Joined:
    Mar 25, 2020
    Posts:
    24
    found some clue: since we simplely use all of the fonts as multiple atlas Dynamic mode, we always reset( fontAsset.ClearFontAssetData(true) ) the atlas in Continues Integration.
    i just tested to don't reset it and leave it with some contents in the atlas. the texts seems will be alright.
    the big broken text in the above screenshot uses another font asset than normal font asset, it is the first text to show with that font asset in my test flow. so i assume that there are some problems when the atlas expands from zero to 1024*1024 on iOS, and once the content of that atlas updated, it turns back to normal.
     
    Last edited: Oct 30, 2020
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you able to reproduce this behavior in some simply repro project? Ie. just some text using a single font asset where you reset it like you do in your main project?
     
  27. xodennisxo

    xodennisxo

    Joined:
    Mar 25, 2020
    Posts:
    24
    Hi Stephan,

    I did some test and found i can reproduce the issue on iOS device in a new empty project(TMP: 2.1.3 or 2.1.0 or 2.1.0 preview 12, unity 2019.3.11f1). the project files i used are here:
    https://github.com/hanxu1210/TMPFontBrokenTest.git

    my reproduce step:
    1. open the project, the test scene is "Scene_5_2", there are 2 TMP texts uses 2 fonts that i met problems in my normal project.

    2. with another scene "New Scene" open, select "DefaultFont" and "SerifHD" and click "Reset" in inspector to clearup their font atlas (there will be no problem if we donot click Reset to remove the used characters)

    3. select "Build and Run" for iOS platform

    4. build in xode with my iphone(xs max), and watch the broken texts. both of the 2 texts have the problems when i swap their fonts.

    Best Regards,
    Dennis Han
     

    Attached Files:

  28. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for providing the updated project and steps to reproduce. I'll try taking a look later today.
     
  29. xodennisxo

    xodennisxo

    Joined:
    Mar 25, 2020
    Posts:
    24
    Thanks to Stephan's help, finally the reason was located.

    The problem in 2019.3.11f1 was gone by using 2019.4.14f1:) It should be the bug of unity font rendering code, and not realted to TMP itself.

    In 2019.3.11f1, the broken font with dots issue happened only on certain iOS devices(Xs max, Xr, SE2) and it doesn't have problem on 6sp, 6s, 8p.