Changefont of GUIText inside GUI.Box

I changed font of GUI text using inspector, now after putting that GUI text into GUI.Box, i am unable to view the change in font but i see change in font size. i tried much code but tired now, need help from you people.

Thanks in Advance :slight_smile:

var TimerGUI : GUIText;
var fontSize : int = 20;

	function OnGUI () {
		TimerGUI.font = Resources.Load(TimerGUI.font.name + "burnstown_dam", typeof(Font));
		GUI.skin.label.fontSize = GUI.skin.box.fontSize = GUI.skin.button.fontSize = fontSize;
		
	    GUI.Box (Rect (0,0,100,50), TimerGUI.text);
	    GUI.Box (Rect (Screen.width - 100,0,100,50), "Top-right");
	    GUI.Box (Rect (0,Screen.height - 50,100,50), "Bottom-left");
	    GUI.Box (Rect (Screen.width - 100,Screen.height - 50,100,50), "Bottom-right");
	}

i also used the below code to change font but also failed, maybe there is not support of font change in GUI.Box but i dont know and i need help

So, a GUIText is a component that can render text to the screen. It’s completely unrelated to the GUI class, which is a way of rendering user interfaces. Your code goes to the trouble of loading a font and setting it on a GUIText, but then you render your text using the GUI class. The size of the font changes because you change the size of the font in the skin used when rendering the boxes. So, put another way, if you set GUI.skin.box.font = whateverYourFontIs; you’ll get what you want.

Note that you’ve violated one of the programmer universal rules. You’ve asked Resources.Load() to get you something, but you’ve not considered that the code might fail and return you nothing. You need to write defensive code that knows what to do when things fail. Worse, you load this font multiple times per frame, since OnGUI() can be called for lots of reasons. If the font load does work, you only need to do this once.