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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Text Mesh pro font sometimes doesn't render on iOS - 2018.2.1/2

Discussion in 'UGUI & TextMesh Pro' started by Antony-Blackett, Aug 6, 2018.

  1. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I've recently updated Unity to 2018.2.1 and also tried 2018.2.2.

    Both are giving me a bug where rarely (about 1/20 launches of the app on iOS) one of my fonts (always the same one) doesn't render at all.

    Inlined icons render correctly and are rendering in the correct position.

    I've looked in the debug log in xCode and there are no errors.

    If I restart the app, the font renders fine. I've never seen this on Android or in Editor or in 2017 versions of Unity.
     
    Last edited: Aug 6, 2018
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Are you using a mixture of normal <TextMeshPro> and <TextMeshProUGUI> objects which might happen to share the same material? If so take a look at the following post / solution.
     
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I'm pretty sure i'm only using TextMeshPro objects.

    I'm not using canvases in my game. So this is not the problem. It's not a sorting issue as this font is not visible in any of the UI screens it's rendered where as the inline icons are.

    And as I said when you restart the app it's fine.

    If the font does not render on app boot then it never renders at all.

    Edit:

    When updating unity I upgraded from the plugin version of TextMeshPro to the built in version of TextMeshPro could this be related?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I don't think it is related to the upgrade. If the font didn't render at all, perhaps but 1 / 20 is pretty strange.

    Can you try the same font asset but with a different material preset?

    Also inspect (with inspector in debug mode) the material used by that font asset and check the Shader Keywords and Custom Render Queue.

    upload_2018-8-5_23-53-16.png
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I'm guessing the render queue should never be -1?

    Screen Shot 2018-08-06 at 5.24.18 PM.png

    Edit: Although all my font materials are -1. Does that just mean use shader default?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    It does.

    I thought the issue could be shader keyword related but I guess not unless something else is setting it on that material (when it happens to not be working).

    Were you able to check if the issue happens using a different material preset for this font asset?

    This might be completely unrelated but I did have another user where text was disappearing in strange ways on the iPhoneX and it was related to scaling using Dotween where the scale of the text object was not kept uniform (ie. X, Y, Z). In his case the Z was left out and in some cases ended up with a value of zero.
     
    Last edited: Aug 6, 2018
  7. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    It's hard to check because it's so intermittent... I'll dedicate tomorrow to finding better reproduction steps.

    I do have a custom shader (edited from the standard TextMeshPro Mobile shader) to add a couple effects. Maybe there's something in the latest version it doesn't like... sometimes...
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    See my previous post (edited part about scaling) as it does sound like something sort of like that.

    P.S. Going to sleep since it is almost 1:00 am for me. I'll check back tomorrow.
     
  9. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Scaling doesn't make sense in my case either as it's missing in all UI that has this font and a lot (if not all) of those screens and UI elements never scale.
     
  10. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Hopefully, you can isolate whether or not this is specific to that font asset or to the material preset used by the font asset. That would help reduce the search for what is causing this.

    Just keep me posted.
     
  11. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I haven't seen the bug again after regenerating the font. But it's only been a day. I'll keep an eye out and let you know if it's still around.
     
    Stephan_B likes this.
  12. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Here are some Unity Performance reporting issues that are new and could be related to the issue I am seeing.

    TextMeshProBug1.PNG TextMeshProBug2.PNG
     
  13. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Is the font asset giving the issue using some fallback?

    If so, check to make sure each of the fallbacks have not lost reference to their atlas texture.

    Also make sure you don't have any circular references between those fallback font assets.
     
  14. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    The fallback font i use for foreign currency symbols had an invalid shader. Could that create those exceptions? In editor all I get is pink quads but no errors when using those symbols.

    Edit:
    I can't get the fallback font to work. I just get these warnings.
    "Character with ASCII value of 8383 was not found in the Font Asset Glyph Table. It was replaced by a space."

    Edit 2:
    Removing the fallback font and then assigning it again fixed those warnings. This is really building my confidence.
     
    Last edited: Aug 8, 2018
  15. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Yes. TMP needs to check the shader type to determine how it should handle the padding.
     
  16. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Is this something you can make more robust? Exceptions are bad especially on Android as Unity basically abandons the rest of that frame and keeps running and then you're left in an unknown state.
     
  17. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Can you confirm that it was indeed related to the shader?

    If it was shader related, was this shader missing or invalid? If invalid what do you mean by that?

    I am certainly open to look at adding additional safety checks but this always needs to be balanced against potential performance impact.
     
  18. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    The shader was missing after the conversion from the previous Text Mesh Pro to Unity 2018.2.x

    I think there needs to be some safety checks at least in editor. Also why would I have not got these exceptions in editor? I've only see them on Android.

    I can't seem to find the source code to see exactly where and why it would have broken. Has that source been removed in the latest version? It's hard for me to understand if it's fixed if all I know is the function name of where it broke.
     
  19. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    That would be the place.

    Was this one of the shaders you modified? If so, it is possible the changes you made are fine for desktop / shader model requirements but exceed those of the targeted device / shader model supported.

    The source code for the version of TextMesh Pro included with Unity 2018.2 which is included via the Package Manager is located in the package cache which on windows is in "\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.textmeshpro@1.2.4" ...
     
  20. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    No, all my text uses this shader so I'd expect to see a lot more issues than what I'm seeing. I think it was just because it wasn't assigned after the upgrade.

    I think we also might be dealing with two problems here, one where sometimes the font doesn't display (Only seen it on iOS still, but not since rebuilding the font), and the other which is the exceptions on Android. The reason I think they are separate is because they are related to different fonts and one ( the exceptions ) will only be an issue when a currency other than $'s is used, hence why I didn't catch it in my own testing. I'll have to add those other symbols into a debug menu or something so i can more easily test they work in future.

    Ok thanks, I'll take a look tomorrow.


    I've rebuilt all my fonts, double checked all the shaders and started another partial roll-out on Android. I'll soon see in performance reporting if the issue is fixed or not. I'll let you know.
     
    Stephan_B likes this.
  21. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    It looks like it's fixed as I'm only getting the usual 'libunity.so' crash bugs in performance reporting now.

    This means your upgrade tool failed somewhere I guess. Maybe when in combination with custom shaders it fails somewhere?

    Just to reiterate, What I did to fix the issues was

    - Re-generate all the fonts in the game.
    - Un-connect (set to none) and reconnect the fallback fonts.
    - Double check all the shaders were assigned to all the font materials (custom shaders all lost their connections).
    - Went through TextMeshPro settings and reset them all to what I had them before the update (default font had changed).
     
  22. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Any chance you could share via the Unity bug reporter the project prior to the upgrade process?

    This would enable me to run it through the conversion process on my end to make sure it is handling things correctly or more importantly to figure out where it might have not.
     
  23. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    That's kinda annoyingly difficult to do. Internet in Australia sucks real bad so I'd have to download the whole project and upload the whole project which is a few gig... it'd take a couple days...

    Yay Australia!
     
  24. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Totally understandable.

    I'll poke around on my end to see if I can spot something in the conversion process.

    Let me know if you run into any other issues.