Good evening, everyone. I was wondering if I could pick your brains about this. So far, the scripts have been working beutifully with exception of this one piece.
I have a button that will go from whatever GUI panel I’m working on to the one before it. The button itself works fine, both in the editor and in the toolset.
The escape key is a little wierd, however. It is being checked at the same time as the button click to see if the key has been pressed, and in the toolset this works as expected. It skips back to the previous panel, just as I’d hoped it would.
The trouble starts when I build and run the application. At that point, the button call still operates properly, but the escape key appears to trigger twice, and ships back past two panels instead of just one.
I even tried taking the escape input check out of OnGUI and putting it by itself in the Update function, and it still has the same behavior for the panel I tried this in. Does anyone have any suggestions as to why this may be happening?
Below is the code for your experienced eyes ![]()
if((GUI.Button(new Rect(150, 575, 200, 50), "<<Back")) || Input.GetKeyUp(KeyCode.Escape)){
this.enabled = false;
GetComponent<GUIChooseRace>().enabled = true;
}