drawing bigger text?

I’d like to put up some labels in a bigger size than what the default style renders, using just GUI classes. I thought I’d make a copy of the default GUIStyle and just change the font. There doesn’t seem to be a way to get the current style. GUISkin will return a style, but only if you already know the name, and there’s no function to get the default name. Is there a clean way to get these labels up?

From what I understand, text is not made on the fly - you tell unity what size you’re going to be using the font, and it creates a default material with all the characters on a texture map at the appropriate size.

Scaling up at this point would result in blurry letters, hence why they don’t give you direct access to the size of the font.

When I want to use different sizes of the same font, I duplicate the font in my assets, right click it, and change the font size in my import settings.

Then, you can drag this in to one of your scripts (via the exposed variable method - btw I use c#), and set the font in OnGUI:

public font bigArialBoldFont;

void OnGUI(){
  GUI.skin.font = bigArialBoldFont;
}

The default font in unity is Arial Rounded Bold, which you can get directly out of the Built-in skin package (this is all the source they used to make the default skin):

Download here:
http://forum.unity3d.com/download.php?id=2325

or topic where I found it here:
http://forum.unity3d.com/viewtopic.php?t=7712&sid=ac2b8091d618aa58c8cc432fdd613acd

Then, you can drag this in to one of your scripts (via the exposed variable method - btw I use c#), and set the font in OnGUI:

Code:
public font bigArialBoldFont;

void OnGUI(){
GUI.skin.font = bigArialBoldFont;
}

Hi, may i check what do u mean by via the exposed variable method? As i attached this script over one of my script. However, i still can’t change my font size. Please help. Thanks in advance

Oh, hehe when I say “exposed variable method” I just mean make a public variable at the top of your script. Add this script to a null game object in your scene, and then you can drag the font onto the script via the inspector view.

In javascript, you expose variables like this:

var bigArialBoldFont : Font;
var smallArialBoldFont : Font;

You cannot change the size of the font within your script directly though. If you want to use two sizes of the same font, duplicate your font in the project view, increase the size on one by right clicking it and going to import settings. Drag both copies into your script. Essentially, you have to pre-prepare your fonts at different sizes.

Now when you want to use them in your gui, in the OnGUI function you do this:

void OnGUI(){
GUI.skin.font = smallArialBoldFont;
GUILayout.Label("hello, I'm small");
GUI.skin.font = bigArialBoldFont;
GUILayout.Label("and I'm big");
}

You can also make your own GUIStyles of course and set the fonts of the styles to your dragged in fonts.