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

Text rendering as blocks briefly. Bug in iOS build.

Discussion in 'UGUI & TextMesh Pro' started by MMcDonald, Jun 2, 2015.

  1. MMcDonald

    MMcDonald

    Joined:
    Mar 20, 2015
    Posts:
    3
    We are having an issue with text not rendering correctly. It will briefly show as black squares before correcting itself after a frame or two, though it's very noticeable. It happens when we update the text on the screen. We are using OpenSans-Bold, but we've seen it with different fonts too including the default Arial font.

    This seems to only happen on iOS builds. We haven't seen it happen in the editor or on android yet. Happens on iOS consistently.

    Below is a snippet of what we're seeing.



    We were on 4.6.3 when we noticed this issue. We updated to 4.6.5 and it didn't fix it so we updated to 5.0.2 and it still didn't fix it. Anyone else seeing this?
     
  2. TimGS

    TimGS

    Joined:
    Apr 24, 2014
    Posts:
    70
    Sometimes I get it on my Android builds. GT-I9000 ans D5503. But those are very rare cases and reinstalling the app usually helps. The font is Roboto. Unity 5.0.2
    Never seen that on 5.1.0f2, so far so good.

    UPD: Sometimes I saw that if there were another app with the same Bundle ID (it happens I'm lazy to change it for a brief test app :) ). Maybe that's the case, haven't tested it yet.
     
  3. MMcDonald

    MMcDonald

    Joined:
    Mar 20, 2015
    Posts:
    3
    Thanks Tim,

    We're seeing it on every iOS build we make, on multiple devices. We've removed the app before installing so there shouldn't be any conflicting bundle IDs. It happens most noticeably to our loading bar which updates text to show the status of the app as it launches. These updates/changes in text can happy very quickly, I'm wondering if that could have an issue with it? However, we did add in some deliberate pauses to slow the process down and the text still appeared as it does in the screenshot I provided for a second before fixing itself.
     
  4. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    If this is a consistent problem with other fonts too, than I would suggest to make a small reproducible and submit a bug report and make sure to mention the bug number here. Make it public so that people can vote on it too, just in case. If it's only with specific fonts, I would assume the fonts might have problems. It would still be interesting for us, so also in this case please report a bug. :)
     
  5. MikeMcDonald

    MikeMcDonald

    Joined:
    Jun 3, 2015
    Posts:
    8
    It happens with every font we've tried. We'll work on making a reproducible and submitting the bug report.
     
  6. HerbertSSchaefer

    HerbertSSchaefer

    Joined:
    Oct 25, 2014
    Posts:
    7
    We are also having the same issue, the problem is that our text is updated each frame in some cases so it will always remain corrupt. It happens in iOS and Android, yet in not every time and sometimes not in the same place or same scene. The same project compiled in Windows for Android don't seems to have the issue. And (until some time ago) depending on the Mac that we were compiling the problem dissapear. Anyone have a idea? (kind of urgent the client is threatening to cancel the project heheeh).

    We have tried disableling the object chage the text, enable back on, change to a string.Empty before changing back, using SetAllDirty, FontTextureChanged, Multiple fonts, all the results are inconsistent.

    A small detail, these texts are or a StringBuilder.ToString or a int.ToString("D6").

    In the image:
    Coins int.ToString("D6") - Changed in delegate
    Diamonds int.ToString("D6") - Changed in delegate
    Below is a chronometer in StringBuilder.ToString() - Loaded once
    And Below is another also in StringBuilder.ToString() - Updated each frame

    unnamed.png

    The ones that appear fine are random each time we load a scene.
     
  7. CharlesBarros

    CharlesBarros

    Joined:
    Nov 17, 2011
    Posts:
    61
    We are facing the same issue in Unity 5.2.0.
    Is there a fix for this issue?
     
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Are you using any custom scripts to manipulate the geometry of the text?

    There is a bug in Unity 5.2 where using CanvasRenderer.SetMaterial(material, null); where using "null" instead of implicitly referencing the font atlas texture will result in this issue on OpenGL 2.0 & 3.0 devices.
     
  9. CharlesBarros

    CharlesBarros

    Joined:
    Nov 17, 2011
    Posts:
    61
    Thanks for the reply Stephan, but I'm afraid that's not the source of my problem. Unfortunately we are not manipulating the text geometry or setting the canvasRenderer material. Is there any other known issues?
     
  10. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    890
    Code (CSharp):
    1.      Shader "GUI/Text Shader" {
    2.      Properties {
    3.         _MainTex ("Font Texture", 2D) = "white" {}
    4.         _Color ("Text Color", Color) = (1,1,1,1)
    5.      }
    6.    
    7.      SubShader {
    8.         Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    9.         Lighting Off Cull Off ZWrite Off Fog { Mode Off }
    10.         Blend SrcAlpha OneMinusSrcAlpha
    11.         Pass {
    12.            Color [_Color]
    13.            SetTexture [_MainTex] {
    14.               combine primary, texture * primary
    15.            }
    16.         }
    17.      }
    18. }
    Then dragg the font texture on to the texture,
     
  11. MochiBits

    MochiBits

    Joined:
    Mar 11, 2014
    Posts:
    30
    Does that fix work? Could you explain how the shader fixes it?
     
  12. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    890
    It works, when you see the font you have, you can open it, then you see the texture file capsulated, dragg it to the texture shader and it will fix the issue.