string colour and font

Searching, and searching and searching. Ive read a few dozen answers now, digged through the manual, but i still dont get it. How do i colour this GUI.Label text, to let`s say give it a black colour? And how do i change the font for it? I simply miss the concept here.

function OnGUI () {
GUI.Label (Rect(32, 100, 200, 400), "I need black, not white \nand another font wouldn`t hurt neither");
}

Could somebody be so kind and provide an example please? :slight_smile:

function OnGUI () {
   GUI.contentColor = Color.black;
   GUI.Label (Rect(32, 100, 200, 400), "I need black, not white \nand another font wouldn`t hurt neither");
}

Use a new GUISkin or GUIStyle with a different font. You can also specify the color in the style or skin instead of code.

–Eric

Thanks Eric. Font is black now :slight_smile:

Any chance of providing an example for this too? That`s the part that made me always scratching my head when reading it in the manual :slight_smile:

If you expose a Guistyle reference in the inspector you can change it’s elements and then reference them in code. You can use this to change font, alignment, color, background images or anything else.

There’s an example of it in the following thread.

http://forum.unity3d.com/viewtopic.php?t=18374

Thanks Quietus :slight_smile:

Im still lost though. Seems i have to increase my knowledge first before im able to understand this one. Well, at least i have my black text now :slight_smile: