public
Created

Untested example of dealing with handled events and focused controls.

  • Download Gist
FocusedEventHandling.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.