Created a script that adds a textMeshPro text in a gameObject that is child of a canvas. But the text is not visible in the gameView playmode but it is visible on scene mode. The text size is made big and the position is Oth point.
Heres the code to make the textmesh object:
public GameObject g; // Use this for initialization void Start () { TextMeshPro mText = g.AddComponent<TextMeshPro>(); mText.autoSizeTextContainer = true; mText.text = "Hello there"; // Set various font settings. mText.fontSize = 748; mText.alignment = TextAlignmentOptions.Center; } How can I make this visible to the camera? and Why its not rendering?
51 Answer
You can place a TextMeshPro GameObject in either world space (Create > 3D Object > TextMeshPro - Text) or UI space (Create > UI > TextMeshPro - Text). As a 3D Object it has a MeshRenderer so it is "in the world" and with the UI version it is "in the screen" using a Canvas.
FYI, your code worked for me, but I had to the using TMPro; directive at the top.
