- Home /
Font size in GUI Label changes between editor and build
I've been trying to format the screen text properly on a Macintosh/PC desktop game, and while GUI text sizes look fine in the editor, as well as on a PC build, the Macintosh build makes the font size slightly larger, enough to run off borders, etc.
This font size change only happens when I create a Macintosh-specific build - it's a bug that took a long time to find, and looks like it will be a pain to debug. Any suggestions as to what to look for would be greatly appreciated!
In the code, I'm looking at the screen size first, and setting the font size relative to that, i.e.:
guiStyle.fontSize = Screen.height/36.0f;
The font itself it part of a GUISkin, a .tff font set to "dynamic."
Answer by zharik86 · Aug 15, 2014 at 05:28 AM
If a problem only on Mac, try to use directives. Write such condition:
public GUIStyle guiStyle = null; //reference for your style
void Awake() {
//Change you size of font
#if UNITY_STANDALONE_OSX
guiStyle.fontSize = Screen.height/45.0f; //or other value > 36
#else
guiStyle.fontSize = Screen.height/36.0f; //for other platform
}
I hope that it will help you.