Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question What is the difference between scale and height and width for a TextMeshPro Text?

Discussion in 'Editor & General Support' started by IIBearWithII, Jun 19, 2023.

  1. IIBearWithII

    IIBearWithII

    Joined:
    Feb 15, 2023
    Posts:
    87
    The scale for the Rect Transform seems to affect the size of the text. But the text still shows when I press play even if it is outside of the white outline (which seems to be related to the Rect Transform width and height settings) or outside of the yellow outline (which I'm not sure what that is for, but I can pull and stretch it in the scene. So what are the white and yellow outlines for?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,718
    1. Don't use scale for UI elements. Leave that for the canvas scaler and maybe very rarely if you're doing some kind of animation on a UI element for some reason
    2. To set the size of the text use the font size setting
    3. The white outline is the outline of the rect of the RectTransform (the actual size of the RT)
    4. The yellow outline is showing you the extents of the margins (there's settings for this buried in the TMP inspector)
     
    IIBearWithII likes this.
  3. IIBearWithII

    IIBearWithII

    Joined:
    Feb 15, 2023
    Posts:
    87
    Ok, thanks so much! That was bugging me. I'll leave scale alone then, thanks. Do I need to pay attention to the white outline at all then, or is it basically irrelevant information for a beginner?
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,718
    The white rectangle is basically the most important thing to pay attention to when placing/laying out your UI elements. It shows the actual position/size of the UI element in the layout.
     
    IIBearWithII likes this.
  5. IIBearWithII

    IIBearWithII

    Joined:
    Feb 15, 2023
    Posts:
    87
    Ok, thanks!