Created
March 19, 2022 17:28
-
-
Save thebne/491644eb6ae0cb1c8bc09c2575e3a5fc to your computer and use it in GitHub Desktop.
Unity: detect arbitrary right click within custom editor
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
if (Event.current.button == 1 | |
&& GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { | |
if (Event.current.type == EventType.MouseUp) { | |
EditorGUI.DrawRect(GUILayoutUtility.GetLastRect(), new Color(1, 1, 1, 1f)); | |
} else if (Event.current.type == EventType.MouseDown) { | |
Debug.Log($"Pressed on {propState}!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment