- Home /
This question was
closed May 24, 2014 at 11:53 AM by
Graham-Dunnett for the following reason:
Duplicate Question
How do I change the font and color of GUI text?
I have a (still unfinished) script that shows text when you enter a trigger, but right now it's just white text in the Arial font. How do I change the color and the font to one of the fonts I imported. (And is it possible to add a shadow or outline to the text?)
var buttonInRange;
var buttonActivated;
var amount : float = 0;
var CamTimer : CamTimer;
private var hasPlayed = false;
function OnTriggerEnter (c : Collider)
{
buttonInRange = true;
}
function OnTriggerExit (c : Collider)
{
buttonInRange = false;
}
function OnGUI ()
{
if(buttonInRange == true)
{
GUI.Label (Rect (Screen.width/2-50, Screen.height/2-55, 120, 50), "Pick up battery");
if (buttonInRange == true)
{
if (Input.GetKeyDown ("e"))
{
GUI.Label(Rect(155, 100, 75, 23), "Batteries: " + amount.ToString("1"));
}
}
}
}
function Update ()
{
if (buttonInRange == true)
{
if (Input.GetKeyDown ("e"))
{
Destroy(gameObject);
hasPlayed = true;
}
}
}
Comment
Why post the same question twice? Was my answer not good enough for you?
Follow this Question
Related Questions
Script loads font, how do I change the color? 2 Answers
How do I change the font and color of GUI text? 1 Answer
Color.white not so much white... 3 Answers
dirty lens effect over light help 1 Answer
change bar position 1 Answer