- Home /
Question by
derrtyones · Sep 14, 2012 at 01:27 PM ·
javascriptguitextguitext
changing font + size of text
Hi,
I am trying to show text on my screen with a custom font and I want to be able to set the size. I cannot get it to work, as I have no clue what I am doing. How can I actually get the correct font-size and use the custom font which I assign in the inspector?
var font : Font;
var fontSize : int = 18;
static var showText : String = "Welcome!";
function OnGUI () {
GUIStyle.fontSize;
GUI.Label (Rect (Screen.width / 2 - 250, Screen.height - 55, 500, 50), showText);
}
Comment
Best Answer
Answer by Eric5h5 · Sep 14, 2012 at 03:39 PM
You have to set the font size in the GUIStyle.
var myStyle : GUIStyle;
function OnGUI () {
GUI.Label (Rect (Screen.width / 2 - 250, Screen.height - 55, 500, 50), showText, myStyle);
}
Your answer
Follow this Question
Related Questions
Create GUIText from Javascript 3 Answers
Fix Blurry UI text? 10 Answers
Gui text, ammo counter 1 Answer