I waited a while to upgrade to the latest version (2018.2.16). I was last using a 2017 release. To my dismay, something strange is now going on with the current event mousePosition function. I use windows within my GUI and, from within those windows’ functions, I check for mouse clicks to perform certain actions. But some windows have mouse-over functionality so they’re constantly polling the current event’s mousePosition and checking if the mouse entered a rectangle (or left a rectangle), then I take the appropriate action such as displaying an item’s details in a popup (or hiding it).
Sometime in 2018, Unity introduced a bug where calls to Event.current.mousePosition from within my window functions will not reflect changes in the mouse position until a click is received. So the X and Y only reflect the position the mouse was at during the last mouse down or mouse up event. This only seems to be happening in my Mac OSX build. It doesn’t happen in the editor and I have not tried a Windows build yet.
To get around this, I resorted to polling Input.mousePosition to get the absolute mouse position, inverting Y, and subtracting the window’s X/Y to get an approximation of what event.current.mousePosition should be. I hate having to do this. Does anyone know a more elegant way to solve this or if Unity plans on addressing it?
These are the kinds of things that make me scared to upgrade. It seems that very few Unity updates are without new bugs that didn’t exist before.
Thanks in advance!