Change GUI.Box text color

I am kind of new to Unity, and was just wondering how to change the text colour of a GUI.Box?

This is the line of code I am using:

GUI.Box(Rect(0, 0, width, height),"Hello World", "");

I tried putting:

GUI.color = Color.red;

above it, but that didn’t work.

Thanks, Fjpackard.

GUI.color doesn’t work because there’s nothing to tint when you set a style without a texture. You need to make a style with a background texture and it also lets you specify your font color.

I’d recommend backgroundColor so you can control your text colour.

Awake() {
        tintableText = new GUIStyle(GUI.skin.box);
        tintableText.normal.background = Texture2D.whiteTexture;
        tintableText.normal.textColor = Color.white;
}

OnGUI() {
    var guicolor_backup = GUI.backgroundColor;
    GUI.backgroundColor = Color.yellow * Color.grey;
    GUILayout.Box("Hi", tintableText);
    GUI.backgroundColor = guicolor_backup;
}

Please review the basics on GUI.Style