- Home /
Event.DragExited returns wrong Event.mousePosition
I'm doing a simple drag and drop in an editorwindow. Testing against DragExited and Rect.Contains(), but the mousePosition returned is always wrong (it appears to always get the editorwindow position not the mouse).
Substituting MouseDown or MouseUp returns the correct mousePosition, why is DragExited different? and how do I get the right position? Thanks!
Rect dropRect = new Rect(0, 20, 100, 50);
if(Event.current.type == EventType.DragExited) { if(dropRect.Contains(Event.current.mousePosition)) Debug.Log("in : " + Event.current.mousePosition); else Debug.Log("out : " + Event.current.mousePosition); }
Same here. I'm running Windows and I don't get a "$$anonymous$$ouseUp" event when the mouse button is released while dragging.
If you are trying to test for when a Drag has been "performed", you must set DragAndDrop.visualStyle to something other than Rejected.
DragAndDrop.visualStyle indicates to Unity that you want the event NOT to the user.