I’m new to unity and working on a settings page for a basic Falldown-type game. After referencing a few things online, I’m rendering text for a GUI through script by creating a new game object for each one:
void Start()
{
GameObject set1 = Instantiate(new GameObject(), guiLocation(1), Quaternion.identity) as GameObject;
set1.AddComponent("GUIText");
set1.guiText.text = "Sensitivity";
GameObject set2 = Instantiate(new GameObject(), guiLocation(2), Quaternion.identity) as GameObject;
set2.AddComponent("GUIText");
set2.guiText.text = "Music";
GameObject set3 = Instantiate(new GameObject(), guiLocation(3), Quaternion.identity) as GameObject;
set3.AddComponent("GUIText");
set3.guiText.text = "Sound Effects";
}
it seems to work well enough, but it seems like there is probably a better way to do it; for some reason, this method creates two gameObjects for each chunk, and I’m having trouble finding out why.
Thank you guys for any help!