Search Unity

Script not actioned

Discussion in 'Immediate Mode GUI (IMGUI)' started by neatgadgets, Oct 22, 2014.

  1. neatgadgets

    neatgadgets

    Joined:
    May 13, 2014
    Posts:
    73
    I have got a class doing the following example login script



    I have 10 out of 11 students with a working product from the following code. I have tried a new project, tried restarting the machine even. The one and only script attached to an empty game object does nothing. I put a debug.log in, and it doesn't run. I put the same debug.log in another persons script, same script, and it does work.

    version 5.4.2

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class LoginMenu : MonoBehaviour {
    5.  
    6.     string loginURL = "http://127.0.0.1/login.php";
    7.     string username = "";
    8.     string password = "";
    9.     string label = "";
    10.    
    11.     void OnGUI() {
    12.         GUI.Window (0, new Rect (Screen.width / 4, Screen.height / 4, Screen.width / 2, Screen.height / 2 - 70), LoginWindow, "Login");
    13.     }
    14.    
    15.     void LoginWindow(int windowID) {
    16.         GUI.Label (new Rect (140, 40, 130, 100), "~~~~Username~~~~");
    17.         username = GUI.TextField(new Rect(25, 60, 375, 30), username);
    18.         GUI.Label (new Rect (140, 92, 130, 100), "~~~~~Password~~~~");
    19.         password = GUI.PasswordField (new Rect (25, 115, 375, 30), password, '*');
    20.         GUI.Button (new Rect (25, 160, 375, 50), "Login");
    21.         GUI.Label (new Rect(55, 222, 250, 100), label);
    22.     }
    23. }