Hello everyone.
I would like to have a GuiText display a timer, i have managed to do so in a easy manner, using this code(The important part, i guess):
var power = 0.0;
function Update ()
{
if(Input.GetButton("Jump"))
{
power += 1 * Time.deltaTime;
}
}
The timer works, but displays 6-7 numbers behind the comma like so 1.1234567(an example). Proberly because the variable "power" is a float and not a int. but if i change it to a int like so:
var power = 0; // Changed
function Update ()
{
if(Input.GetButton("Jump"))
{
power += 1 * Time.deltaTime;
}
}
Then it dose not display anything at all.
So, is there a way to only get it to display 1 number, and notning more whatsoever, instead of 6-7 numbers behind the comma?
Thank you for your time.