Reputation: 208
In Unity3D I have this GUI Box that I scaled to the screen size. But the problem is that its text is not scaled correctly. The text has the same font size for any screen resolution. How can I set up the text's height and width when I display it? Screen Resolution is 1920 x 1080. Appreciate the help!
GUI.Box(new Rect(Screen.width / 2 - Screen.width / 6 / 2, Screen.height - Screen.height / 8, Screen.width / 6, Screen.height / 8), ("View [E]"));
Upvotes: 0
Views: 1227
Reputation: 208
Turns out, you can make a new GUIStyle with the preferences you want.
GUIStyle myStyle = new GUIStyle();
myStyle.fontSize = 20;
GUI.Box(new Rect(Screen.width / 2 - Screen.width / 6 / 2, Screen.height - Screen.height / 8, Screen.width / 6, Screen.height / 8), "Hello", myStyle);
Link about more style are here: GUIStyles
Upvotes: 0