0

First of all, sorry for my bad grammar. Could anyone tell me why my box is not showing up? I already put these Script at my main camera but it still doesn't work. Or is there any way to fix this? Thank you

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Login : MonoBehaviour {

public GUIText loginText;
public static string Email = "";
public static string Password = "";

public string CurrentMenu = "Login";

private string CreateAccountUrl = "";
private string LoginUrl = "";

public float X;
public float Y;
public float Width;
public float Height;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnGUI(){
    if(CurrentMenu == "Login"){
        LoginGUI();
    }
    else if(CurrentMenu == "CreateAccount"){
        CreateAccountGUI();
    }
}

void LoginGUI(){
    GUI.Box(new Rect(X, Y, Width, Height), loginText);
}

void CreateAccountGUI(){

}

}
  • It is `OnGUI` not `OnGui` By the way, you are not supposed to be using this. Check the duplicate answer. You both made the-same `OnGui` mistake. Also, the `Text` component should be used for this. – Programmer Mar 23 '17 at 05:15
  • I already edit it but it still doesn't work :/ . And for the text component showing error, Error CS1503 Argument 2: cannot convert from 'UnityEngine.GUIText' to 'string' – Cayza Angka Maulana Mar 23 '17 at 05:32
  • 1
    Again, you should'n be using `OnGUI` or `GUI.Box`. Read that solution I posted. Take time and read it. If you still want to use `OnGUI` then change `GUI.Box(new Rect(X, Y, Width, Height), loginText);` **to** `GUI.Box(new Rect(X, Y, Width, Height), loginText.text);` – Programmer Mar 23 '17 at 05:56

0 Answers0