zligg
zligg

Reputation: 49

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:

public class username : MonoBehaviour {

private static string user = "";

void OnGui()
{

    GUI.Label(new Rect((Screen.width / 2), (Screen.height / 2), 300, 300), "Username");
    user = GUI.TextField(new Rect(-4, 0, 100, 100), user);

    if (GUI.Button(new Rect(-4, 0, 200, 30), "Continue"))
    {
        WWWForm form = new WWWForm();
        form.AddField("", user);
        WWW w = new WWW("http://site/register.php", form);
        StartCoroutine(register(w));
    }

}

Thanks

Upvotes: 0

Views: 202

Answers (1)

peterept
peterept

Reputation: 4427

OnGui() is case-sensitive and needs to be OnGUI().

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnGUI.html

Upvotes: 4

Related Questions