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

Question Font Size when set to Auto Size

Discussion in 'UGUI & TextMesh Pro' started by Morphus74, Oct 20, 2021.

  1. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Does anyone know what is the name of the field (public or private) that can give me the calculated font size?
    upload_2021-10-20_14-3-33.png

    In my case 22.75, I've look in debugger and didn't find it
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The property is
    Code (csharp):
    1.  
    2. /// <summary>
    3. /// The point size of the font.
    4. /// </summary>
    5. public float fontSize
    6.  
    Note the fontSize only gets updated after the text object has been processed / rendered.

    For instance, if you are changing some of the text properties and need to know "right away" what the resulting results will be, you can use ForceMeshUpdate() to force an immediate update of the text object.

    See the following post which might prove useful to you.
     
  3. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Thank you
     
    Stephan_B likes this.