- Home /
Question by
luxidium · Aug 23, 2014 at 04:36 PM ·
javascriptstringfloat3d text
3d text will not display float
I have a simple health script that displays the health to a 3d text object above the enemy but I get the follow error
Cannot convert "float" to "string"
How do I fix this? My code (javascript)
var EnemyHealth : float = 10f;
function update(){
GetComponent(TextMesh).text = (EnemyHealth);
if(Input.GetMouseButtonDown(0))
{
EnemyHealth -= 1;
}
}
Comment
Answer by YoungDeveloper · Aug 23, 2014 at 04:37 PM
GetComponent(TextMesh).text = EnemyHealth.ToString();