Change a 3D TEXT at run time?

Hello Unity pros ;)

I have a 3D TEXT over a simple AI. That 3D TEXT should display the AIs health. I have a script like so:

var Health = 100; 

function Update () 
guiText.text  = "" +Health;

When finished this should display the AIs health, that is not the hard part though. It is a 3D TEXT I am using, but

guiText.text = "BLAHBLAH"

dose not work on a 3D TEXT. It says there is no guiText attatched to the "Script." Of course there is not because it is a 3D TEXT. But i have not been able to find a prober method to change a 3D TEXT at runtime, when the player shoots at it or something.

Is there a method like so?:

3DguiText.text = "BLAHBLAH"

Thanks :)

GetComponent(TextMesh).text = “blah”;


TextMesh t = (TextMesh)gameObject.GetComponent(typeof(TextMesh));
t.text = s;


t : TextMesh = gameObject.GetComponent(TextMesh);
t.text = s;


using UnityEngine; using System.Collections;

public class Game : MonoBehaviour {

public TextMesh p_3dText_health;

void Start () { p_3dText_health.text = "50% Health"; } }