Hello, I have a problem. I can’t change color of GUIText. I created skin with color I need , but still can’t use it. please, help me to solve the problem:)
use thath into our gui function:
GUI.contentColor = Color.yellow;
(change color by change Color.yellow;see documentation for aviable colors)
Remember to set coloror to blank for show icon with correct color(Color.white).
public var txt :GUIText;
function OutputName(NameOfCreep:String)
{
GUI.contentColor=Color.yellow;
txt.text=NameOfCreep;
}
It is still white:(
u have to use on GUI function:
function OnGUI () {
GUI.contentColor = Color.red;
GUI.Box (Rect (0,0,600,200), "red text");
GUI.contentColor = Color.yellow;
GUI.Label (Rect (10, 70, 50, 20), "Yellow text");
GUI.contentColor = Color.white;//restore default color.
}
okay, but i want to use own frame without rectangle
my is example to use color on GUI function.
for show only text use label.
Change my example with this:
function OnGUI () {
GUI.contentColor = Color.red;
GUI.Label (Rect (10,40,50,20), "red text");
GUI.contentColor = Color.yellow;
GUI.Label (Rect (10, 70, 50, 20), "Yellow text");
GUI.contentColor = Color.white;//restore default color.
}
GUI.Box show a box,just use GUI.Label for show only text.
guiText.material.color = Color.red;