using UnityEngine;
using System.Collections;
public class menu : MonoBehaviour {
bool flag;
void Start () {
DontDestroyOnLoad(this);//这个作用是场景切换时,一下代码不撤销
flag=true;
}
void Update () {
if(Input.GetKeyDown(KeyCode.Escape)){
if(flag){
flag=false;
}
else{
flag=true;
}
}
}
void OnGUI(){
if(!flag){
return;
}
if(GUI.Button(new Rect(Screen.width/2-50,Screen.height/2-30,40,60),"test01")){
Application.LoadLevel(1);
}
if(GUI.Button(new Rect(Screen.width/2,Screen.height/2-30,40,60),"test02")){
Application.LoadLevel(2);
}
if(GUI.Button(new Rect(Screen.width/2+50,Screen.height/2-30,40,60),"Quit")){
Application.Quit();
}
}
}