modify 3DText attached to Prefab

My character’s are instantiated using a prefab. This prefab has a 3DText GameObject attached to it. I want to modify this Text with the nickname entered in the GUI.

My question is how can I access the 3DText of the instantiated Prefab.

var player=Network.Instantiate(PlayerPrefab, SpawnObj.position, Quaternion.identity, 0);
	
var textMesh: TextMesh=(player.GetComponent(TextMesh) as TextMesh);

This code gives me this Error:
NullReferenceException: Object reference not set to an instance of an object

You say 3dText Gameobject attached to it…do you mean it is a child gameobject? If so, you need to call:

player.GetComponentInChildren(TextMesh);

var player=Network.Instantiate(PlayerPrefab, SpawnObj.position, Quaternion.identity, 0);

    var textMesh: TextMesh = new TextMesh();

textMesh = player.GetComponent(TextMesh);