Create a float with only 1 decimal? C#

Hi! I’m trying to make a timer count upwards in my 2D mobile game, I got it to work but how can I round of a float to only 1 decimal? For instance the game now writes out “1.123”. How can I change that to be “1.1”, 1.2", 1.3" etc?

Code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class TimerScript : MonoBehaviour 
{
	//Create timer
	public static float timer = 0.0f;

	//Create displayed timer
	Text text;
	
	void Awake()
	{

		//Load Text class
		text = GetComponent<Text> ();

		//Reset the timer
		timer = 0.0f;

	}

	void Update()
	{

		timer += Time.deltaTime;

		text.text = "" + timer;
	}

}

Got it to work :slight_smile: Just changed:

text.text = "" + timer;

to:

text.text = "" + timer.ToString("F1");