Reputation: 6967
I'm trying to dynamically create some GUIText at runtime in 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";
}
No errors, only nothing shows up! What am I missing?
Upvotes: 0
Views: 1183
Reputation: 2618
Capitalize "s" in start()
. Remember to do that for things like Update()
, Awake()
, etc. Generally, your function names should be capitalized in C#.
Upvotes: 1