Output text GUI not working

Hi to all!

I am new to Unity, so maybe it would be a stupid question to somebody, but:
I am trying to create a text filed which will give random float, it does not appear.

I have created object called GUI Text, added js with following content:

var THP_press: float;
var font: Font;
var fontsize: int;

function Start () {
var targetText : GameObject;

				THP_press=Random.Range(-1.0,9999.0);
				var THP_press_string = THP_press.ToString();	
				
				targetText.guiText.text = THP_press_string;

				guiText.font = font;
				guiText.fontSize = fontsize;
				
				}

Can anybody help me to find out how to make it work?

Succeeded!

This is the sample:

var THP_press: float;
var font: Font;
var fontsize: int;

function Start () {
var targetText : GameObject;

				THP_press=Random.Range(-1.0,9999.0);
				var THP_press_string = THP_press.ToString();	
				GetComponent(TextMesh).text = THP_press_string;	

				GetComponent(TextMesh).font = font;
				GetComponent(TextMesh).fontSize = fontsize;
				

				}

Klarax, thank you for help :slight_smile:

TextMesh is your answer. TextMesh is designed for providing 3D text, the in world stuff. GUIText is designed for GUI elements, details on a HUD, tooltips, anything you want flat on the screen.