Detecting when a user starts and finishes moving an object with the Move tool in Editor

I’m developing a custom editor to assist with creating levels for my tile-based (but still 3D) tactics game. One of the features is a Diablo-style grid snapping system for props and other grid-occupying objects that allows designers to drag the prefab out over the grid, see any collisions it might have with existing geometry-filled tiles, and drop it in an empty space. If they attempt to drop an object in a space that isn’t empty, it should snap back to its position before they started moving it.

I have most this system already developed and working for me, but thus far I haven’t been able to find a good means of detecting these two states in my custom editor code, to tie it all together:

  • When a user has first started to move an object with the Move transform tool (ideally before it moves).
  • When a user has released the mouse button and stopped moving an object with the Move transform tool.

Is there a way to catch the move tool specifically? I had considered using these along with “Tools.current == Tool.Move”, but that would only check to see if the move tool was chosen, not if it was actively in use. It would then trigger a pointer up/pointer down if you clicked anywhere on the screen, and not just while the move tool was being used to move an object around.

You can tap into the Unity event system, specifically the OnPointerDown, OnPointerUp and OnDrag methods