Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kpavlovsky/2039d18f93a0580be247 to your computer and use it in GitHub Desktop.
Save kpavlovsky/2039d18f93a0580be247 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class menuscript : MonoBehaviour {
public bool menuopen;
public float timeswitched=0f;
public float menufreeze = 0.5f;
public Rect windowRect = new Rect(100, 100, 80, 50);
// Use this for initialization
void Start () {
menuopen = false;
}
// Update is called once per frame
void Update () {
if (Input.GetKey ("up")) {
if (timeswitched + menufreeze < Time.time) {
if (menuopen == false) {
menuopen = true;
} else {
menuopen = false;
}
timeswitched = Time.time;
}
}
}
void OnGUI(){
if (menuopen == true) {
windowRect = GUI.Window (0, windowRect, DoMyWindow, "Game Time");
}
}
void DoMyWindow(int windowID) {
GUI.Label ( new Rect (45, 20, 45, 20), "Ya menu");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment