- Home /
OnMouseOver not called for fast mouse movements
OnMouseOver() is not called if you move the mouse quickly enough over an entire GameObject. This makes sense as the mouse events are likely coming from the OS (Windows in my case) and run at some fixed rate.
I was wondering if there was an easy/built-in way to "interpolate" the mouse if it moved a large distance in a given frame. I can see how it would be possible to compare currentMousePos with prevMousePos and interpolate along that vector with smaller steps, but I can't think of an easy way to then fire an OnMouseOver event.
Would I would need to maintain a list of whatever I wanted to check mouse over events for and manually do this check?
Thanks!
Answer by misher · Sep 03, 2018 at 06:21 AM
Mouse movement updates are sent from operating system, on unity part you may of course write/extend/overtide your own events system, it's hard but doable. Although I suggest you to try different approach to intercept events. OnMouseOver is an old style, try to use EventSystem interfaces: IPointerEnterHandler and IPointerExitHandler, they may be more precise.
Your answer
Follow this Question
Related Questions
imeCompositionmode 0 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
OnMouse menu 1 Answer
The OnMouseOver and OnMouseEnter functions cease to work when screen.lockcursor = true 0 Answers