ScriptReference/Event.Use #401
Replies: 1 comment
-
Comment by Event.Use() will stop the event from being used after your code, but the Scene view will keep registering mouse clicks unless you use the following code. The important part is void OnSceneGUI () {
Event e = Event.current;
var controlID = GUIUtility.GetControlID(FocusType.Passive);
var eventType = e.GetTypeForControl(controlID);
if (eventType == EventType.MouseUp) {
Debug.Log("Mouse Up!");
GUIUtility.hotControl = controlID;
e.Use();
}
else if (eventType == EventType.MouseDrag) {
Debug.Log("Mouse Drag!");
e.Use();
}
else if (eventType == EventType.MouseDown) {
Debug.Log("Mouse Down!");
GUIUtility.hotControl = 0;
e.Use();
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ScriptReference/Event.Use
https://docs.unity3d.com/ScriptReference/Event.Use.html
Beta Was this translation helpful? Give feedback.
All reactions