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));
}
}
由于
答案 0 :(得分:5)
OnGui()区分大小写,需要是OnGUI()。
http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnGUI.html