How display a value in GUI Text without numbers after comma

Hi, please somebody for help… i’d like to display the value information distance between 2 object to a int unit distance (ex. 105cm and not 104.5445) How delete numbers after point ? and display in unit for display a measure in Cm.

This is my code

var camera : Camera;
var point : GameObject;
var texte : GUIText;

function update (){
var distance = Vector3. distance(camera.transform.position, point.transform.position);


texte.guiText.text = "Distance : " + disance/9 + "cm";



All the best.


You can set the format with ToString(“F0”):

texte.guiText.text = "Distance : " + (distance/9).ToString("F0") + "cm";

The format string “Fn” rounds to the decimal places specified by n - “F2” will show 2 decimal places, for instance.