I'm having trouble getting the text in Unity's "text mesh" to change its text at runtime.

public class ShipPropulsion : MonoBehaviour
{
bool onGround = false;

	int mph = 90;

        void Update()
	{
		GameObject speedometer = GameObject.Find ("Speedometer");
		string readSpeed = speedometer.GetComponent<TextMesh>().text;
		readSpeed = mph.ToString();

	}
}

I have attempted this a few different ways, and I’m not getting any errors, but I’m also not getting anything else. The value just stays displayed as “50” as I’ve set it in the inspector. I’ve tried substituting the int with a string, and still get no change in the display at runtime.

I’m sure it’s something simple.

In need to actually change the object referenced by the TextMesh.text. So instead do:

speedometer.GetComponent<TextMesh>().text = mph.ToString();