我正在尝试在运行时在GUIText中动态创建一些Unity3D。
void start()
{
GameObject bananas = new GameObject("SomeGUIText");
Instantiate(bananas);
GUIText myText = bananas.AddComponent<GUIText>();
myText.transform.position = new Vector3(0.5f,0.5f,0f);
myText.guiText.text = "Hello";
}没有错误,只是什么都没有出现!我遗漏了什么?
发布于 2014-04-03 16:13:22
在start()中大写"s“。记住,对于诸如Update()、Awake()等的事情,应该这样做。一般来说,函数名应该用C#大写。
https://stackoverflow.com/questions/22840881
复制相似问题