GUI.Label font change ?

Hi im trying to change the arial font to a different one for my GUI.Label but having zero luck :frowning: I have seen lots of different answers to this problem but none seem to work can anyone give me a clue please ,sorry I am the JavaNoob :slight_smile:

function OnGUI(){

var font : Raptor_Sans_font_by_rotweiler83;

GUI.Label (Rect (400,120,110,100), "Checkpoint : " + ckp); GUI.Label (Rect (340,10,110,100), “Laps” + lap);

gives me this :frowning:

Assets/Checkpoint.js(27,12): BCE0018: The name ‘Raptor_Sans_font_by_rotweiler83’ does not denote a valid type (‘not found’).

Check out the GUISkin tutorial.

This is also good if your wanting to know more.

var MenuSkin : GUISkin;

function OnGUI ()
{
    GUI.skin = MenuSkin;

}

Create a GUI skin ,Assets > Create > GuiSkin. Create that script and drag the it onto the camera object , assign a font in the inspector to the skin you just created. Drag your new GUI skin onto the MenuSkin value on the camera in the inspector. That should be it.

Ok to change font by code all you need to do it create a var

var font : Font

then within Start() or Awake()

do something like this

guiText.font = font;

This will change your current font to you new font.

Just make sure that you pull a font onto the variable