- Home /
OnPointerExit doesn't work
In the new UI the OnPointerExit (aswell as OnPointerEnter) doesn't work if instead of pointer leaving(or entering) - the UI element itself is moved while the pointer is stationary. Is this how it should work and how do I work around it?
I can't confirm if what you say is true but I can think of a workaround if it is true. Everytime the object is moved, check if pointer is inside/ outside the object (see: RectangleContainsScreenPoint)(or you may have custom logic). For example, if it was outside before moving and inside after moving then invoke OnPointerEnter.
Also I wonder, if pointer gets inside the object when object is moved but OnPointerEnter is not called, after that, will OnPointerExit be called if you exit normally?
It calls the OnPointerExit when I exit the original location of the element, even though it isn't there anymore.
I don't move the button itself directly, but it's parent panel, for which I update its position every frame for smooth lerping.
Really weird...
I found that if I stop the manual movement the exit event gets called immediately after.
Ok - short summary in this video: https://www.screenr.com/pquN
Hmm, I can't think of anything about this. $$anonymous$$aybe you should report it as bug since you already have the video they will consider looking into it.
Answer by cucumars · Jul 01, 2018 at 10:03 AM
public class try1 : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
Your answer
Follow this Question
Related Questions
[4.6 - UI] How to call an event with button when the pointer is up the button image. 1 Answer
Showing text on top of a Slider, but not blocking Handler? 1 Answer
Android screen is small? 0 Answers
Get object at mouse position? (UI) 0 Answers
4.6 Button OnClick Super Sensitive to pointer movement. 1 Answer