Created
August 19, 2011 09:23
-
-
Save keijiro/1156433 to your computer and use it in GitHub Desktop.
Detect click on the outside of GUI.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var guiIsHot : boolean; | |
function Update() { | |
if (Input.GetMouseButton(0) && GUIUtility.hotControl != 0) { | |
guiIsHot = true; | |
} | |
if (Input.GetMouseButtonUp(0)) { | |
if (!guiIsHot) { | |
Debug.Log("Hooray!"); | |
} | |
guiIsHot = false; | |
} | |
} | |
function OnGUI() { | |
GUILayout.Button("button1"); | |
GUILayout.Button("button2"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment