Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created September 8, 2011 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngryAnt/1203085 to your computer and use it in GitHub Desktop.
Save AngryAnt/1203085 to your computer and use it in GitHub Desktop.
Untested example of dealing with handled events and focused controls.
const string controlName = "My text field";
string myString = "Text";
void OnGUI ()
{
EventType handledEventType = Event.current.type;
GUI.SetNextControlName (controlName);
myString = GUILayout.TextField (myString);
if (Event.current.alt && handledEventType == EventType.mouseDown && Event.current.type == EventType.used && GUI.GetNameOfFocusedControl () == controlName)
{
Debug.Log ("Alt-click handled with focused control being " + controlName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment