Search Unity

[SOLVED] Corrupted Text Component

Discussion in 'UGUI & TextMesh Pro' started by MasterControlProgram, Aug 20, 2020.

  1. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    48
    Please see the below screenshot. We're getting this corrupted text throughout our UI. It's hard to pinpoint exactly what causes it. Seems like it happens somewhat randomly but definitely happens on some mobile devices more than others. For example, we have some Android devices that often see it while some higher end iOS devices never see it.

    There isn't really anything very complicated going on with the text. It's a Text component where the text field is set in script. Rect transform isn't stretched, simple center pin. In this case, the text is within a scrolling UI. But we also see the corruption on simple text. One little thing we've noticed is that it seems to occur if another canvas element was covering the text at some point. Might be a red herring though.

    Does anybody have any ideas what might be causing this? I've looked online and have seen similar reports (both in editor and in game). Any help would be greatly appreciated.

    Screen Shot 2020-08-19 at 8.07.07 PM.png
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks like each of the characters are pointing to incorrect UV coordinates in the atlas texture.

    Are you using UI Text or TextMesh Pro?

    Possible reasons for this issue might be texture compression settings or some caching issue. See if changing texture compression has any affect on this.

    What version of Unity are you using?
     
  3. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    48
    It's UI text and is using a font asset (otf).
    Unity version: 2019.4.3f1

    How do I adjust the texture compression on the font asset? Know how to do with a texture obviously. But not sure with the font asset type.

    It's also worth noting that it's not 100% on devices that it happens on. It sometimes happens, sometimes doesn't.

    Here's the component:
    Screen Shot 2020-08-20 at 4.26.31 PM.png

    And here's the asset:
    Screen Shot 2020-08-20 at 4.27.06 PM.png
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If it happens sometimes, then the issue might be related to the Legacy text system caching (ie. a bug)

    Or it could also be related to Addressables where it uses the incorrect texture for the font.

    Are you able to reliably reproduce this behavior?
     
  5. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    48
    Interesting, we do heavily use server delivered Addressables. So the second would make sense in our case. Is there anything I can do to potentially work around the Addressables case? Perhaps the Addressable group settings.

    Another interesting tidbit is that I've actually been able to reproduce it on a Unity Add-On called SuperTextMesh as well. Looks exactly the same and is a completely different text component. Which makes me think that rules out the Legacy text system bug and more points to the font asset itself.

    We are pretty reliably able to reproduce this behavior on certain devices. I've never seen the problem in Editor. One of the devices we've been able to consistently reproduce it on is an iPhone 7.

    Another thing I've considered is switching things over to NGUI font atlas to see if problem still exits. Any other things I should try?

    Thanks so much for the help!
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I would suggest submitting a bug report with the project and steps to reproduce the issue.

    I would not switch to another UI framework as the issue isn't related to UGUI but to something messing with the atlas texture.

    I would try disabling Super TextMesh as this addon might be trying to combine several mesh and check if the issue persists with it disabled.
     
  7. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    48
    Hi Stephan, just a little update here. You advice was correct. We were using SuperTextMesh in our project in a limited way for its ability to render images inline with text. This component referenced a font asset in the project. And this font asset is the same one that UI Text was utilizing for the majority of text. The workaround fix, allowing us to still use SuperTextMesh in our limited way, was to duplicate the font asset and only let SuperTextMesh touch one and UI Text touch the other. I'll reach out to the dev of SuperTextMesh to let them know the problem as I'd guess it's something they are doing to the font asset.
     
  8. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    522
    If this is of any interest, I got & fixed that bug ; I had to comment out Resources.UnloadUnusedAssets() after having installed Unity 2019.4.12f1 (it was working in my previous version, but I forgot its number).

    (And no, I don't have the time to do a repro :p )