Skip to content Skip to sidebar Skip to footer

What Does Actually Fontsize Mean In Unity?

I'm developing Unity Android/iOS application. I need to show text with size relative to screen size and density. Material design guide says I should set size of my regular text to

Solution 1:

So... Font Size is essentially "defined" in three places in Unity.

The first is on the font asset itself (the import settings). As far as I've been able to determine lately (post-Unity 4.5), this value is not used (I've tweaked it to insane values and had no affect on what is displayed on-screen; I know in Unity 3.5 this affected the final rendering of the font and I had to scale it up really big to get nice, cleanly rendered text, as it was effectively the "maximum font size available" and font sizes larger than this value (see #2) would get blurry).

The second is on the text component, called Font Size which does what it says. It's like picking a larger font size in any application. This is what the material design guide is referring to. Text component font sizes in Unity are measured in "pixels of height" and are 1:1 with screen pixels (except when the transform--or any of its parent transforms--are scaled, or if the canvas itself is in Worldspace (in which case you kinda have to guess)).

The third place is on the text object's Transform: you can additionally scale the object and get the (apparent) font size to change although scaling it up will make it look blurry and scaling it down will make it look aliased. Either way it looks bad.

All that said, I've found best results to be to double the font size and reduce the transform scale to 0.5 as the text anti-aliasing at the default scale looks blurry to me, so using a bigger font size and scaling the object transform back down sharpens it up. You'll still want to test for yourself if it needs it.

Post a Comment for "What Does Actually Fontsize Mean In Unity?"