x


Change GUILayout.Button font color

Hi,

I have to create a strange keyboard and I have some problems...

GUILayout.BeginArea(new Rect(x,y,2*v/3,b/3)); GUILayout.BeginVertical("col1"); GUILayout.BeginHorizontal("fila 1"); if(GUILayout.Button("Q",GUILayout.Width(t),GUILayout.Height(t))) key='q'; if(GUILayout.Button("W",GUILayout.Width(t),GUILayout.Height(t))) key='w'; ....

GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea();

I need to paint 5 letters in red...

How can I change the GUILayout Button font color?

Thanks!!

more ▼

asked Apr 12 '12 at 01:33 PM

nikiii gravatar image

nikiii
11 3 4 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can use GUI.contentColor to give a specific part an other color :

function OnGUI() {

    GUI.Button("Standard Colored")
    GUI.contentColor = Color.red;  // Apply Red color to Button
    GUI.Button("Q button")
    GUI.Button("W button")  //...and so on for the rest Buttons
    GUI.contentColor = Color.withe;  //Make Buttons White color again 
    GUI.Button("White Colored Again")
}
more ▼

answered Apr 12 '12 at 02:26 PM

GameGuy gravatar image

GameGuy
610 22 28 40

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x194
x134
x58
x5
x1

asked: Apr 12 '12 at 01:33 PM

Seen: 1428 times

Last Updated: Apr 12 '12 at 02:26 PM