Text Boxes Not Visible
I'm trying to instantiate textboxes as labels on a region map, but when I run this code, none of the text shows up.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Region : MonoBehaviour
{
public bool sea;
public GameObject[] adjacentRegions;
void Start()
{
GameObject label = new GameObject();
label.AddComponent<Text>().text = gameObject.name;
label.GetComponent<Text>().color = Color.black;
label.GetComponent<Text>().fontSize = 40;
label.GetComponent<Text>().font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
Instantiate(label, gameObject.transform.position, Quaternion.identity);
}
}
Thanks for the help!
Comment