I want to dismiss a GUI.Window by tapping outside it. I created a GUITexture for the background, and can see it getting hit. But it sees hits right through the popup. How can I detect a hit on just the .Window?
void OnGUI()
{
settingsWindowRect = GUI.Window(0, settingsWindowRect, DoSettingsWindow, "Settings");
}
void DoSettingsWindow(int windowID)
{
if (GUILayout.Button("Hello World"))
print("Got a click");
}
void Update ()
{
if(Input.GetMouseButton(0) && splashBackgroundGUITexture.HitTest(Input.mousePosition))
{
Debug.Log("Background Hit");
}
}