Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Text Showing as solid blocks in Screen Space Camera mode

Discussion in 'UGUI & TextMesh Pro' started by robrab2000-aa, Dec 10, 2019.

  1. robrab2000-aa

    robrab2000-aa

    Joined:
    Feb 8, 2019
    Posts:
    117
    Hey,

    I'm having an issue where my text (in Text Mesh Pro) is showing up as solid rectangles when I switch the camera from ScreenSpace - Overlay to ScreenSpace - Camera. The problem seems to mainly be happening when the plane distance is super low. I need the plane distance to be low however so that the UI elements always appear above the 3d objects in the scene (which sometimes come quite close to the camera).

    I've been setting the plane distance to 0.03 (my near clipping plane on the camera is set to 0.01) which means that I can see all the elements, they're still interactable, and the render in front of the 3d elements but this is what is happening to the text.

    Is there a setting which can fix this for me?

    This is how it looks in screen space - overlay:
    text okay.PNG

    This is how it looks in screen space - camera:
    text not okay.PNG
     
    Last edited: Dec 10, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you export a simple scene for me to look at? I am not able to reproduce the behavior on my end.

    P.S. Make sure the scale of the text object is uniform (x, y, z) should all have the same values. You can also test the overlay version of the TMP shaders.
     
  3. PlaysportOllie

    PlaysportOllie

    Joined:
    Apr 30, 2021
    Posts:
    1
    Did this issue get resolved in the end? I am having the exact same issue in Unity 2018.4.29f1 when using Text Mesh Pro. Any help would be appreciated.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do you get this issue with a specific font asset or with all font assets?

    Make sure the scale of the text object is uniform (X, Y, Z).

    In the Debug Settings section of the Material inspector, make sure Scale X & Y is 1.

    Are you doing any scaling of the text object? Like trying to animate it where you might be changing its scale? If so make sure we don't end up with the scale being zero.

    Can you post an image of the text object inspector so I can see the transform values, text component values along with material inspector with Debug Settings panel expanded.

    P.S. What is the scale on your Canvas and Plane Distance on the Canvas?
     
    Last edited: Jun 25, 2021
  5. lixi_x

    lixi_x

    Unity Technologies

    Joined:
    May 5, 2021
    Posts:
    9
    The issue was originally caused by having too low of a plane distance value which results in extremely small scale value 0.0000x and therefore it can't be represented properly in canvas:
    upload_2021-6-25_9-34-36.png
    Are you also using small scale/plane distance/clipping plane values in your project? If so please follow @Stephan_B suggestions and try to use larger scale factor.
     

    Attached Files:

  6. GuirieSanchez

    GuirieSanchez

    Joined:
    Oct 12, 2021
    Posts:
    405
    I'm also having this issue: the text (in TextMeshProUGUI) is showing up as solid rectangles when using a camera with "ScreenSpace - Camera". If the Projection is set to 'orthographic', the texts render correctly.

    On the left side is how they should appear while on the right side is what they look like when using a Perspective Camera:
    upload_2023-5-18_11-37-15.png

    I should mention that these squares with child TexMeshProUGUI components are prefabs that are spawned during play mode, and sometimes they spawn and show correctly, while the vast majority of the time they show as solid squares (right side).

    Here's what the camera looks like:
    upload_2023-5-18_11-32-0.png

    I tried manipulating the "Plane distance" on the Canvas (so that the scale is big enough) but to no avail:
    upload_2023-5-18_11-30-40.jpeg

    The text's scale is also (1, 1, 1).
     
    AshwinTheGammer likes this.
  7. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    69
    Same problem here, in scene view the text shows up as solid white blocks