x


gui.label color change

I want to change the color of a GUI.Label using script

  GUI.skin.label.hover.textColor = Color.blue;
  GUI.skin.label.normal.textColor = Color.black;
  GUI.skin.label.active.textColor = Color.yellow;

I want to change the color of label using scripts. The color is changing in GUI.skin in in inspector.

When using above script but it is not not working for label and box in game mode. I don't want to change the color using applying directly in skin in inspector. I want change through scripts.

more ▼

asked Mar 03 '11 at 11:28 AM

robert 4 gravatar image

robert 4
396 13 16 27

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

1 answer: sort voted first

Use either of these (but don't forget to reset it after your GUI call or all other GUI gets tinted also):

GUI.color

Global tinting color for the GUI.
This will affect both backgrounds & text colors.

GUI.color

GUI.backgroundColor

Global tinting color for all background elements rendered by the GUI.
This gets multiplied by color.

GUI.backgroundColor

GUI.contentColor.

Tinting color for all text rendered by the GUI.
This gets multiplied by color.

GUI.contentColor

more ▼

answered Mar 03 '11 at 11:38 AM

Statement gravatar image

Statement ♦♦
20.1k 35 70 175

(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:

x505
x379

asked: Mar 03 '11 at 11:28 AM

Seen: 4768 times

Last Updated: Mar 03 '11 at 11:49 AM