I have the same problem. I found several thread talking about GUI Labels, but I cannot “join” all together to make a GUI.Label using custom font size and color.
I use this code, but does not work:
function OnGUI() {
var myStyle : GUIStyle = new GUIStyle();
myStyle.fontSize = 50;
GUI.color = Color.white;
GUI.Label (Rect (200, 200, 600, 100), "Creazione scenario...", myStyle);
}
In this way I get the correct font size but color is still black. If I do:
I am using 3.3 and I have the same problem. I think there is a bug in the GUI.skin.label (or more likely my understanding on how this works)
I tried setting the font size and color, but it does not work in the inspector for GUISkin → Label (although it works for GUISkin → TextField and others)
So I though I could do it in code and tried the following in On GUI:
//Changes only color
GUIStyle localStyle = new GUIStyle(GUI.skin.label);
localStyle.normal.textColor = Color.red;
localStyle.fontSize = 12;
//Changes both color and font size
GUIStyle localStyle = new GUIStyle();
localStyle.normal.textColor = Color.red;
localStyle.fontSize = 50;
It seems that as soon as try to set the font size specifically on the label, whether in the inspector or code, it does not work. I am a bit confused on this…
To my knowledge you cannot set the fontsize. Well, maybe you can, but that would just be scaling. I think you need to import the font with the desired fontsize.
Eventually scaling down is fine. Means, you import the font with ponitsize 48, and the et it to 32, 16 or whatever.
Not sure about that.
But you definatly define the fontsize for best results with import settings.