Hi all,
i have worked with unity before six months. but am trying and working with GUI windows. it’s giving trouble to me about 2 hours. here is my code
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
public GUIStyle background = new GUIStyle();
private bool menus = true;
public Rect window1 = new Rect(3,3,Screen.width-3,Screen.height-3);
void OnGUI()
{
GUI.Label(new Rect(0,0,Screen.width,Screen.height)," ",background);
if(menus)
{
if(GUI.Button(new Rect((Screen.width)/2-50,(Screen.height)/2-60,100,30),"Play Game"))
{
Application.LoadLevel(1);
}
else if(GUI.Button(new Rect((Screen.width)/2-50,(Screen.height)/2-20,100,30),"Settings"))
{
window1 = GUI.Window(1,window1,settingsWindow,"");
menus = false;
}
else if(GUI.Button(new Rect((Screen.width)/2-50,(Screen.height)/2+20,100,30),"Credits"))
{
}
}
}
void settingsWindow(int windowID)
{
GUI.Label(new Rect(50,50,100,30),"Volume");
}
}
i have worked before in the same thing. here the problem is the new window is not opening. can any one say what am doing wrong?? Thank you in advance.