Editor EventType.MouseDrag not working with left mouse

Hi all, I want to call a function in my editor script while dragging my left mouse button, but it only works when I press the middle or right button and move the mouse, while if I press the left one it starts selecting the elements in the scene.Here’s a piece of the code, what am I doing wrong?

void OnSceneGUI()
{
        Event e = Event.current;

        if (e.type == EventType.MouseDrag )
        {
            Debug.Log("MouseDrag");
           
        }

 }

Help me please

Make sure to invoke Use() on your event once you’ve hapily processed it

Additionally, I think this should work, after you’ve processed event.

int blocking_ix = GUIUtility.GetControlID(FocusType.Passive);
UnityEditor.HandleUtility.AddDefaultControl(blocking_ix);
UnityEditor.GUIUtility.hotControl = blocking_ix;

or maybe even

UnityEditor.GUIUtility.hotControl = 0;

on its own …or just

UnityEditor.HandleUtility.AddDefaultControl(blocking_ix)

Don’t remember, have a play around

if (Event.current.type == EventType.MouseDown)
{
// Override the selection in the scene view
GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive);

                    Event.current.Use();

                    _startPos = Event.current.mousePosition;
                    
                    Debug.Log(_startPos);
                }

void OnSceneGUI()
{
Event e = Event.current;

		if (e.type == EventType.MouseDrag && e.button == 0) {
			Event.current.Use ();
			Debug.Log ("MouseDrag");
		}
	}

If you want to move the object around delete Event.current.Use ();