Changing TextMesh text via script

Been banging at this for awhile and its time to ask for help. In a script attached to GameObject A, I’m trying to update the text of a TextMesh attached to a child object of GameObject B.

Various iterations all have resulted in syntax or object expression/conversion errors; I currently have (in script on GO A)

TextMesh theText = transform_GO_B.Find("myMesh").GetComponent(TextMesh);
theText.text = "booyah!";

which is not valid/working. How do I form the reference to child object/Text Mesh on GameObject B from GameObject A?

I Think that if you use GameObject.Find instead of Transfom.Find, it will work.

But you can also try finding the child by using Transform.Find or Transform.GetChild.

Notice the path in Transform.Find.

This should throw an exception “Expression denotes a type', where a variable’, value' or method group’ was expected”

Type

TextMesh theText = (TextMesh) transform_GO_B.Find("myMesh").GetComponent(typeof(TextMesh))

or with generics

TextMesh theText = transform_GO_B.Find("myMesh").GetComponent<TextMesh>();

myMesh has to be a child of transform_GO_B then.