Search Unity

TMP Blocky text sometimes after updating project from Unity 2018.3 to 2019.1

Discussion in 'UGUI & TextMesh Pro' started by sarebots2, May 30, 2019.

  1. sarebots2

    sarebots2

    Joined:
    Jul 4, 2016
    Posts:
    34
    Windows 10, Unity 2019.1.4f1, TMP package manager v2.0.1 & v2.0.0, doozyUI v2.9.4

    upload_2019-5-30_16-51-41.png
    upload_2019-5-30_16-53-30.png

    The bug occurs in play mode on instantiated notifications containing TMP UGUI
    It fixes itself after I expand debug settings or any other setting in any SDF asset, or if I change the text.
    Upon re-entering play mode the bug may or may not occur.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you doing anything to the scale of those text objects?

    Are you able to reproduce this behavior reliably? If so, can you provide me with a simple repro project or test scene?
     
  3. kevin-hololabs

    kevin-hololabs

    Joined:
    Jul 17, 2018
    Posts:
    8
    I am also getting blocky text at random when upgrading to 2019.1. We are not scaling our text. We are using the TextMeshPro/Mobile/Distance Field shader. Our set up is not the UGUI version tho, ours are using the Text Mesh Pro script. The text will look fine when designing the scene, but when playing some of the objects in the scenes text will now be blocky. The objects that do get the blocky text will be blocky every time. For us to fix it we wait a certain amount of time then disable and renable the Text Mesh Pro component. Attached images show what it looks like before disabling, and after re-enabling.
     

    Attached Files:

  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you able to provide a simple repro project / scene of this that I could look at?

    This is most likely related to SDF Scaling. You mentioned that you do not scale the text objects. What about their parents? Make sure you are using uniform scale between X, Y, and Z.
     
  5. kevin-hololabs

    kevin-hololabs

    Joined:
    Jul 17, 2018
    Posts:
    8
    I went through the hierarchy of the object leading up to the text mesh pro object, and it all has a uniform scale between the X, Y, Z, in fact they are all just (1,1,1). I do have instances where i have two Text Mesh Pro objects under a shared parent with one tmp object rendering fine and one rendering blocky. I am trying to put something small together but its hard getting it reproduced in a smaller scene. I have these building prefabs and i pulled one of them into its own scene but now the text is rendering fine in that scene. Now playing my game all of the text that used to be blocky is rendering fine, but all of the text that used to render fine is now blocky. Will continue trying to get a consistent example but its proving tricky.
     
  6. sarebots2

    sarebots2

    Joined:
    Jul 4, 2016
    Posts:
    34
    Yes, I'm changing the scale/position of the parent container. I tried but I can't reproduce this behavior in another project. (The current project is a large project with a lot of packages, assets, experimental features, deprecated assets etc, so it's hard to pinpoint what may be causing the issue). For now, is there a fix that comes to your mind?
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Is the scale of the parent and child text object uniform? Do you at any time have a scale of 0?
     
  8. sarebots2

    sarebots2

    Joined:
    Jul 4, 2016
    Posts:
    34
    It did start with a scale of 0, changed it to 0.01 and the problem appears to be fixed :)
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The case of Scale = 0 should be handled correctly in version 1.4.1 and 2.0.1 so I'll take a closer look as you may have found some scenario where this is not handled correctly.

    Can you provide more information on your setup? For instance, is the text object or parent with scale zero enabled or disabled to begin with? Looking for information that will enable me to reproduce the behavior.
     
  10. sarebots2

    sarebots2

    Joined:
    Jul 4, 2016
    Posts:
    34
    Since I'm using DoozyUI 2.9.4 UI Notification system, as far as I can tell this is how it works:
    Notification container is instantiated with a scale of 0, canvas and graphics raycaster disabled (local components of notification container, there is a master canvas on the notification's parent that is unaffected), scale is always uniform everywhere. Notification container's children include an image and the TMP UGUI is a part of the image's children. In the next frame the scale becomes starting scale (used to be 0, now I made it 0.01 and there's no bug anymore) and the canvas and graphics raycaster components are enabled in the same frame. After that it animates the scale to 1 based on real time.

    P.S. This error did not happen in 2018.3, but happened after updating 2018.3 project to 2019.1
     
  11. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This new behavior is the result of a change I made related to how the SDF Scale is handled in version 1.4.x / 2.0.x. This is why I knew to ask about the scale being zero.

    Having said that, the case of scale being zero should have been handled so I need to double check / figure out why this is still occurring.
     
  12. hawaiian_lasagne

    hawaiian_lasagne

    Joined:
    May 15, 2013
    Posts:
    123
    I was tweening transform.localScale from vector2.zero (0,0,0) to vector2.one (1,1,0) which actually sets the z-value to zero. Changing this to vector3.zero -> vector3.one fixed the issue.

    This only seemed to be a problem for me using Screen Space - Camera with a perspective camera.