I am making a turn based strategy game and creating a UI that follows the units. I do this by obtaining the world position of each of the units, calculating the screen position using WorldToScreenPoint, and then positioning the UI at that point on the screen. This was working fine until I opened Unity recently and found that WorldToScreenPoint was returning different values based on whether Unity was receiving input or not (i.e. mouse movement, mouse clicks, keystrokes etc).
After some investigation I found that the values for the screen size were changing (i.e. Screen.width and Screen.height) whenever unity detected input, though there is no noticeable visual change (the screen appears to stay the same size). The value that the screen size is changing to when input is detected appears to be the correct value because the UI looks to be positioned correctly, and positioned far from the unit when no input is detected.
Are there any ideas as to what could cause this?
If this is relevant, I am using version 2019.2.5f. I also installed a Windows update between when the UI was working correctly and when it broke. Is there any know bug that might cause this?