aim 3D text at camera

I am trying to aim instantiated 3d Text at the camera. It all compiles but the text won’t aim. Here’s the code:

Instantiate(textMesh, pos, textMesh.transform.rotation );
		GameObject cam = GameObject.FindWithTag("MainCamera");
		Debug.Log (cam);
		target = cam.transform;
		Transform textTransform = textMesh.transform ;
		Debug.Log (textTransform);
		textTransform.LookAt(target);

Thanks for any solutions.

You need to set the LookAt for the instantiated object. You are doing it for the textMesh currently. It should be:

GameObject instantiatedTextMesh = (GameObject) Instantiate(textMesh, pos, textMesh.transform.rotation );
 GameObject cam = GameObject.FindWithTag("MainCamera");
 Debug.Log (cam);
 target = cam.transform;
 Transform textTransform = instantiatedTextMesh.transform ;
 Debug.Log (textTransform);
 textTransform.LookAt(target);