OnGUI will not show up?
OnGui won't show up when I start the game for some reason. I've attached the script to a gameobject:
void OnGui()
{
GUI.Label(new Rect(-3, 1, 300, 300), "Username");
user = GUI.TextField(new Rect(10, 10, 100, 100), user);
if (GUILayout.Button("OK"))
{
WWWForm form = new WWWForm();
form.AddField("", user);
WWW w = new WWW("http://mywebsite.com/register.php", form);
StartCoroutine(register(w));
}
}
Thanks
Comment
Answer by rutter · Nov 08, 2015 at 06:39 AM
Unity looks for a function named OnGUI, but yours is OnGui, which won't match. Capitalization counts!
Other than that, make sure that the script is attached and active somewhere in the scene you're playing.
Your answer
Follow this Question
Related Questions
I want to spawn objects probabilistically. 0 Answers
unity create scene from script and pass information between scenes 0 Answers
Random Generation (Dungeon) with improvements in mind. 0 Answers
How to use the results of a dice roll? 2 Answers
How do i Instantiate sub-Points with in Multiple Points?? 0 Answers