title: Unity editor capture "hold mouse down and move" event
body: <p>I am creating a simple tilemap editor extention in unity because the default one lacks a lot of functionality my project needs. I am inheriting EditorWindow.
  When holding the left mouse button and dragging the mouse i want to place tiles in the scene (in editor mode).</p>
  <p>The picture below illustrates what behavior i want.</p>
  <p><a href="https://i.stack.imgur.com/VfsNz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VfsNz.png" alt="enter image description here" /></a>:</p>
  <p>The problem i face is how to recognize this event. This is the function for handling mouse input that i use:</p>
  <pre><code>void HandleMouseInput() {
      Event e = Event.current;
      switch (e.type) {
      case EventType.MouseDown:
          if (e.button == 0) PlaceTile();
          break;
      case EventType.MouseMove:
          Debug.Log(&quot;Moving&quot;);
          Debug.Log(e.button); // &lt;-- always show 0 (left click) even though mouse is not clicked.
          break;
      }
  }
  </code></pre>
  <p>The first case (single tile placement) works as expected. But i fail to capture the &quot;left mouse button held down&quot; event. I can capture a mouse move event <code>EventType.MouseMove</code> but i then need whether there was a left click. According to unity docs, <code>e.button == 0</code> indicates a left click (which works as expected in the first switch case). But in the second case <code>e.button</code> is always 0, regardless of what mouse button is clicked. There is a <code>EventType.MouseDrag</code> aswell but it seems to only trigger when you select a gameobject in the scene and drag it.</p>
  <p>In Unity, when holding down the left mouse button and moving the mouse the default behavior seems to be creating a selection box:</p>
  <p><a href="https://i.stack.imgur.com/kqoIm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kqoIm.png" alt="enter image description here" /></a></p>
  <p>Or dragging the entire scene if the hand icon is selected in the top left corner of the editor.</p>
  <p>Essentially i want to capture this event and override the result with my own functionality.</p>
  <p>EDIT: I think i could solve this by creating a custom tool <a href="https://docs.unity3d.com/ScriptReference/EditorTools.EditorTool.html" rel="nofollow noreferrer">https://docs.unity3d.com/ScriptReference/EditorTools.EditorTool.html</a></p>