Search Unity

Help with text disappearing

Discussion in 'Getting Started' started by Iqew, Jun 5, 2017.

  1. Iqew

    Iqew

    Joined:
    Nov 26, 2016
    Posts:
    38
    Hello everyone!
    So recently I was experimenting with UI elements. For some reason, text elements disappear after a certain font size is reached. How do I fix this?
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    There are two things to consider when working with the size of UI elements.

    One is the font size, which is what you're changing. Easy enough.

    The other is the RectTransform of the element. All UI elements have a RectTransform that determines their size and positioning on the screen. This size (units are in reference to the size determined by the CanvasScaler component on your Canvas) is the maximum size your element can be. So if your font-size is 50 and your element's height is only 40, your text is going to disappear since the default behavior is to hide overflowed text on elements.

    To ensure your text is visible, set the font-size to less than or equal to the height of the element or set the Text's Horizontal/Vertical Overflow property to Overflow as appropriate.
     
  3. rl112304

    rl112304

    Joined:
    Oct 22, 2020
    Posts:
    1
    this didn't work for me
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Hey, welcome to the forums. Would you care to provide a bit more information other than what I said not working? Maybe share a screenshot of your Inspector panel with the problematic UI element selected.