Search Unity

How exactly is text sized?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Marscaleb, May 10, 2020.

  1. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    I'm writing some scripts to make sure everything I draw in my GUI is scaled properly regardless of the resolution the game runs at. If a given icon takes up 10% on the screen at this resolution, it takes up 10% at this resolution. Basic stuff, really.

    But I'm getting a bit thrown at making sure my text is drawn at the correct scale. And as I started going through a bunch of experiments to see what size my text needs to be, well, I realized this is probably information someone already has.

    So, how does the game really interpret the numbers for font sizes?
    When I change the font size in a GUIStyle, what does that value really translate to? What is consistent here?