float to string

sorry for the lame… but i can’t wrap my head around java/oop… Thus… I cannot convert a simple string to float…

private var seconds : float = 0.0;

function Update ()
{
seconds = GameObject.Find(“Character1”).animation[“Whole”].time;
guiText.text = seconds;
}

Appreciate in adivce.

Thanks
Oliver :slight_smile:

I think

seconds+"";

should work

guiText.text = seconds.ToString(); (Should do Find once in Start and store the result in a variable rather than execute it every frame.)

–Eric

guiText.text = seconds.ToString();

Everybody all at once, now. :wink: Better to use ToString() and avoid string concatenation (faster, probably less memory use, makes the code more obvious).

–Eric

worked… thanks novashot…

I need to post more questions… i’m trying to figure things out over hours when i can get replies in 2 min on this forum…

thanks so much!

oliver :slight_smile:

Thanks. I knew there was probably a reason to do it the correct way :stuck_out_tongue:

I think simple questions like this are better suited for the IRC channel :slight_smile: