Change TextMesh text in script


I need to change the text in a TextMesh in a script. I have googled it, look it up here but no luck. If you know how to do this, please tell me!


Also, I’m working in C#

I got it fixed.

How I did it:

I made a new variable

public string theText;

Then I added this in a void update.

void Update () {
		TextMesh t = (TextMesh)gameObject.GetComponent(typeof(TextMesh));
		t.text = theText