Overlapping GUITexture UI Buttons


What I have is a UI that will pop up when the user clicks the menu button. The new window will now take up the entire screen and overlay notop of the menu button.

My problem is that when I open the pop up window and I click in the position of the menu button, it still registers that click on the menu button. If I wanted to put a different button in it’s place when the window is opened, there is a conflict and both the new button and the menu button would be registered as clicked.

I am using GUITexture for this. Could someone give me some guidance?

Also look at GUI.ModalWindow

Very common question, please search for questions/answers, tuts, vids, code snippets and other resources for additional information.

Three things to avoid the overlapping issue:

GUIUtility.hotControl when checking fo the GUI.Button press

Event.current.Use() immediately after the button is pressed

return at the end of the button-press code (just to be sure).