- Home /
Help Changing GUI Text size
I need some help changing the size of my displayed timer. The timer is visible but you can't see it unless you really look for it. This is the code I'm currently using.
private var startTime;
private var restSeconds : int;
private var roundedRestSeconds : int;
private var displaySeconds : int;
private var displayMinutes : int;
var countDownSeconds : int;
function Awake() {
startTime = Time.time;
}
function OnGUI () {
//make sure that your time is based on when this script was first called
//instead of when your game started
var guiTime = Time.time - startTime;
restSeconds = countDownSeconds - (guiTime);
//display messages or whatever here -->do stuff based on your timer
if (restSeconds == 60) {
print ("One Minute Left");
}
if (restSeconds == 0) {
print ("Time is Over");
Application.LoadLevel(7);
}
//display the timer
roundedRestSeconds = Mathf.CeilToInt(restSeconds);
displaySeconds = roundedRestSeconds % 60;
displayMinutes = roundedRestSeconds / 60;
text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds);
GUI.Label (Rect (400, 25, 100, 30), text);
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Dialouge text. 1 Answer
c# add/move lines of text in GUI box 1 Answer
Gui text, ammo counter 1 Answer