GUIBox fontSize without changing other labels?

Hi, I have this script that nicely changes the font size of my gui

	int fontSize = 100;
	
	void OnGUI () {
	
	GUI.skin.label.fontSize = GUI.skin.box.fontSize = GUI.skin.button.fontSize = fontSize;
        GUI.Box (new Rect ((Screen.width/2) - 75,(Screen.height/2) + 50 - 50,150,100), "Test");

	}

The problem is just, that it also changes the font size of other GUI’s from other scripts. How can I make only the GUI.Box’s font to be changed?

Thanks, Andreas :slight_smile:

Please help, everything has the font size 100 now and I can’t change it.

Although it’s not really advisable to alter a skin’s properties, you can achieve it via something like this:

var originalSize:int;
var mySize:int;
function Awake(){
originalSize=GUI.skin.label.fontSize;
}

function OnGUI(){
GUI.skin.label.fontSize=mySize;
//GUI.Label calls here
GUI.skin.label.fontSize=originalSize;
}

Hey,
If you didnt solve your problem yet, try this:

void OnGUI(){
GUI.skin.button.fontsize=20;

GUI.Button(new rect(10,10,100,100),"Button1"));

GUI.skin.button.fontsize=30;

GUI.Button(new rect(10,10,100,100),"Button2"));

GUI.skin.button.fontsize=10;

GUI.Button(new rect(10,10,100,100),"Button3"));

}

hope it will help!! best