IPointerExitHandler.OnPointerExit not triggered while holding mouse button down

Noticed that IPointerExitHandler.OnPointerExit are not fired when exiting a visual element while holding a mouse button down. The event is fired first when button is released and the pointer is outside the element.

  1. Hover mouse cursor over a visualelement.
  2. Hold any mouse button down and move it outside the element into game view. Notice that no exit event occurs.
  3. Release button. Exit event is triggered.
    Unity Editor 6000.0.25

I would expect that the event is triggered when the cursor leaves the the element even if a mouse button is held down like it works in UGUI.

Are you using an element that captures the mouse on MouseDown or PointerDown, like a Button?

Thatā€™s interesting. In my test I used a visual element with basically just background on it. No button.

Uh. :confused: That could have been an easy fix. Hmm. Do Does it happen in Builds too? UITK has a few quirks/bugs in the GameView related to events that can cross the barrier between EditorWindows.

Yup, I tested it in a build as well with the same result. At least itā€™s a consistent behaviouršŸ˜‰

Oh, Man. :/. Sorry I canā€™t be of more help. If you share a link to the issue tracker, Iā€™ll vote for it, for whatever itā€™s worth. Sometimes it takes a while, though. I have a ListView bug thatā€™s been in the issue tracker for three months ā€œUnder Considerationā€, and a SerializeReference one thatā€™s been there since May, with some pretty thorough reproduction examples.

Otherwise, maybe in the mean time, you could do a workaround by using MouseMove to track the mouse position? :frowning:

I did a workaround by using PointerLeaveEvent and PointerEnterEvent instead.

1 Like