Hello,
I have this script which should only work when the menuactive = true, but in fact it’s completly ignoring, so the GUI menu continues to show :
void OnGUI(){
if(menuactive){
if(GUI.Button(new Rect(410, 750, 100, 26), "Tab to Hide")){
}
// when my set time is reached
if (myCounter1 >= mySetTime1) {
// show GUI Button
//BUY GOBLIN
if (GUI.Button(new Rect(410, 800, 210, 26), "1. Buy Goblin: 50 Gold")) {
myCounter1 = 0;
}
}
else{
GUI.Button(new Rect(410, 800, 210, 26), "Cooldown");
}
if (myCounter2 >= mySetTime2) {
// show GUI Button
//BUY ARCHER
if (GUI.Button(new Rect(630, 800, 210, 26), "2. Buy Archer: 60 Gold")) {
myCounter2 = 0;
}
}
else{
GUI.Button(new Rect(630, 800, 210, 26), "Cooldown");
}
// add time to counter
// use myCounter++; (same as myCounter+=1;) to count the frames - or
myCounter1 += Time.deltaTime;
myCounter2 += Time.deltaTime;
}
}
And second, How can I make my Cooldown button system to work when I press a key and not by mouse click (as is is now).
Thank you