I need to combine them so that my GUI constantly updates.
private var IsRKeyPressed : boolean = false;
private var IsRocksButtonPressed : boolean = false;
function Start () {
}
function Update () {
//Is R key being held down
if (Input.GetKey (KeyCode.R)) {
IsRKeyPressed = true;
} else {
IsRKeyPressed = false;
}
//Opens Rock Menu
}
function OnGUI () {
if (IsRKeyPressed == true){
//Rock Category (With rock items/models)
if (GUI.Button (Rect (0,20,100,100), "Rocks")) {
IsRocksButtonPressed = true;
if(IsRocksButtonPressed == true) {
if (GUI.Button (Rect (200,50,100,100), "Small Rock")) {
}
}}}}