Hi
How do i remove all dp after a number? rounding seconds to β55β rather than β55.43β
Currently using something like
if(Timer > 0){
Timer -= Time.deltaTime;
Timer = Mathf.Round(Timer * 100.0f) / 100.0f;
}
Full code -
var Timer : float = 60.0;
var TextStyle = new GUIStyle();
//var Drop = 6;
function Update() {
if(Timer > 0){
Timer -= Time.deltaTime;
Timer = Mathf.Round(Timer * 100.0f) / 100.0f;
}
if(Timer <= 0){
Debug.Log("Dropped");
}
}
function OnGUI(){
GUI.Label( Rect(Screen.width -500, 40, 200, 30), "Drop in:" + Timer, TextStyle);
}
and using 0.0f was giving me the good old NaN error for diving by zero.
Thanks
P.S - sorry if a repost, couldnβt see after a quick google