- Home /
Weird Resolution Problems; Virtual and Desktop resolutions don't match, offset Mouse Cursor
Hello,
Running a Unity 5.2.2p2 game, I get the following output in the output_log file:
<RI> Initializing input.
<RI> Input initialized.
desktop: 3840x2160 60Hz; virtual: 1920x1080 at 0,0
<RI> Initialized touch support.
This is causing issues while playing because the mouse cursor coordinates act strangely. The custom mouse cursor and input recognition only occurs in the top left quadrant of the screen. Everywhere else, the default Windows cursor shows up and no UI or game interaction can take place.
The computer's screen is natively 1920x1080 and Windows is configured to run at this resolution. Nvidia's 4k Downsampling is disabled in the control panel, so I'm unsure how Unity is detecting this resolution. Older Unity games don't have this problem, I haven't tried newer.
Any clue as to how to fix this?
Thanks!
I'm having a similar, related issue. We want our game to run at the desktop resolution, but its getting scaled down to fit within the virtual resolution.
Answer by pslattery · Jun 09, 2017 at 08:59 PM
I know this is a bit of an older question but I have been running into an issue surrounding this problem for days now and I finally found a solution.
So for anyone reading this in the future: If you look in a Unity Log file, you will see the line @Ikeruga put above:
desktop: 3840x2160 60Hz; virtual: 1920x1080 at 0,0
'desktop' refers the to the actual output resolution Windows is sending the display 'virtual' refers to the total desktop area, which is defined by the smallest square which circumscribes all desktops. When defining this size, Windows takes into account the Scaling of each window.
And that is the part that was tripping us up: Windows scaling displays the reverse of the operation it describes. So instead of scaling UP the text, icons etc by 200%, it appears that it is actually scaling down the window by 50%.
So if you have a 3840x2160 resolution desktop but it is scaled to 200%, your virtual desktop will come out to 1920x1080.
What this means in Unity, is that if you have any scaling on any scaling >100% on any of your monitors, and you try and set one or more of your displays to show at what you think is the native resolution, Unity will silently just scale down the display. I think this is the part that any Unity Engineers reading this should take into account. I don't care that this is expected behaviour, I just wish it weren't silent.