I have a TextMesh. I need it to be made entirely programmatically. If I don’t change the font, it is a pink mess of unreadable blocks. I can then change my font in the editor, and it works fine. But when I try to change it programmatically, the text just vanishes. Where am I going wrong here?
GameObject dialogueContainer = new GameObject("Dialogue");
dialogueContainer.transform.parent = transform;
TextMesh dialogue = dialogueContainer.AddComponent<TextMesh>();
dialogue.transform.position = transform.position + new Vector3(0, 5, 0);
dialogue.text = "Hello World";
dialogue.font = new Font("Arial"); //this is the line that makes it vanish,
//but if I do this in the editor, it works great