[Solved] UI Mouse Position acting strangely when changing fullscreen mode

Hi everyone,

I’m currently working on a settings menu for my game that will allow users to change the resolution of the game, as well as changing between Windowed/Exclusive Fullscreen/Fullscreen Window. All fairly standard stuff, but I understand that this wasn’t supported in Unity until relatively recently (version 2018.1, I think?).

I currently have a settings menu that allows this, but what I’m noticing is that when switching between these modes, it is inconsistent whether or not I get black bars at different aspect ratios or it stretches to fit the screen and that the mouse begins behaving very strangely.

After the change, the position that the UI considers the mouse to be in is off relative to what’s visible. In some cases, the mouse has to be several inches above and to the left of where the actual button is. I sort of understand in theory why this might be happening, but I was wondering if anybody had encountered this before and if there’s anything that can be done to avoid it/make this behaviour more consistent?

Here is a build containing just the main menu, in case anybody would like to try to reproduce the issue. It can be done easily by switching to a lower resolution, usually at a different aspect ratio to yours (I have been switching to 4:3 on a 16:9 monitor) and then switching between Exclusive Fullscreen and Fullscreen Window.

I am working in 2018.1.6f1

Any help would be much appreciated!

I have tried running this in Unity 2018.2.0f1 and the issue appears to be fixed, however, there is a new issue where if calling Screen.SetResolution to change to fullscreen, the resolution that is passed is ignored.

For example, if running at 1280x1024 in a borderless window, if I try to change to Fullscreen 1280x1024 it will default the resolution back to my native resolution when the change is applied.

It does seem though that these are issues in Unity itself.

Well, seeing as how the original issue I was having seems to have gone away in 2018.2, I’m assuming it was a bug and that it’s been fixed.

As for the new related issue that I was having in Unity 2018.2, I reported a bug and received a response acknowledging that they had been able to reproduce it and would be sending it to the engineering team, so I suppose I’ll make this thread as solved.