【发布时间】:2021-11-18 09:15:36
【问题描述】:
我正在尝试将文本添加到 Unity 中的动态输入框。我正在使用 Text Mesh Pro 资产。输入框是在我想要的位置创建的,但没有显示文本。
代码如下:
public GameObject inputs;
public GameObject beginplek;
// Start is called before the first frame update
public void Start()
{
GameObject newinput = Instantiate(inputs, beginplek.transform.localPosition, beginplek.transform.localRotation) as GameObject;
newinput.transform.SetParent(GameObject.FindGameObjectWithTag("aaaa").transform, false);
newinput.name = "periode12";
GameObject.Find("periode12").GetComponent<TextMeshProUGUI>().text = "Hello World";
}
【问题讨论】:
标签: c# unity3d textmeshpro