Hello guys i need help with my GUI text for when the time decreases the timer keeps on moving basically the mili seconds. I Can anyone help me make the timer stable and not moving. Thanks appreciate the help!
P.S. if possible edit my code i really would appreciate it!
Code:
#pragma strict
var timer : float = 10.0;
var addTime : float = 10.0;
var guiShow : boolean = false;
var fontSize: int= 40;
public var guiSkin : GUISkin;
function Update()
{
timer -= Time.deltaTime;
if(timer <= 0)
{
Application.LoadLevel("Seraph game");
}
}
function OnGUI()
{
GUI.skin.box.fontSize=30;
GUI.skin.box.wordWrap=true;
GUI.color = Color.yellow;
GUI.skin = guiSkin;
//GUI.Box(new Rect(10, 10, 100, 40), "00: " + timer.ToString("0"));
GUI.Box(new Rect(10, 10, 100, 75), "Time left : " + timer.ToString("f2"));
if(guiShow == true)
{
GUI.Box(Rect(105, 20, 60,50), "+" + addTime.ToString("0"));
showGUI();
}
}
function showGUI()
{
yield WaitForSeconds(2);
guiShow = false;
}
![alt text][1]
[1]: /storage/temp/74329-untitled.jpg
↧