How to limit calculations to one decimal place?

What I want to do is have a timer on top of the screen counting how long you have been alive. The code for it is simple, and it works:

var aliveTime : float = 0;

function Update () {
    aliveTime += Time.smoothDeltaTime;
    guiText.text = "Time: " + aliveTime;
}

The problem is, it shows 7 places after the decimal. I want it to show just one so it looks like this: 70.7. I do not want it the other way as it is VERY distracting and no need for it to be so precise. I would like to know how to do this as it will help keep track of scores and what not.

Use this:

guiText.text = "Time: " + aliveTime.ToString("f1");

I think this question was asked a while ago (though QATO doesn’t seem to give the year with the date), but in case anyone comes across it:

To round floats to arbitrarily decimal places without converting to strings (as in Eric5h5’s solution), you can use (as a general solution):

function round(x, decimalPlaces) {
    return Mathf.Round(x * Mathf.Pow(10, decimalPlaces));
}

If you specifically only ever want one decimal place:

rounded = Mathf.Round(unrounded*10)/10;

Or two:

rounded = Mathf.Round(unrounded*100)/100;

And so on…

(As an aside, you can also use this kind of technique to round to the nearest anything: e.g. to round to nearest interval of 0.3 by using Mathf.Round(x/0.3)*0.3.)