ClientSim
ClientSim copied to clipboard
Mouse cursor is not centered in Game window on high-resolution monitors with display scaling
Steps to reproduce
- In Windows, enable display scaling (i. e. 150%) on a high-resolution monitor (i. e. 4k)
- Open Unity and enter ClientSim's play mode.
Expected: Mouse centeres inside game window Actual: Mouse is far to the left of the play window. In a multi-monitor setup, the mouse may end up on a different monitor.
Details
This bug was also present in CyanEmu. Clicking the left mouse button may lead to losing focus.
Would be great if this was fixed! 🌈
This also causes issues when intentionally losing focus, i. e. to interact with the editor. The mouse cursor can snap back to the 'center' of the game window. So my editor windows frequently get scrambled, by accidently clicking & yeeting them.
I can't even click the button on the splash screen in mine :(
Edited to add: I'm testing this in Linux, also with Unity scaled up by setting $GDK_SCALE=2 and $GDK_DPI_SCALE=0.5 because I have a ridiculous 4k monitor as well. No scaling problems if I boot to Windows.
Oh! I just noticed there's a scale slider, that at least gets the menu visible, but with the scaling enabled, I can't get the mouse into the right position to click "accept" so the simulator is totally unusable.
CyanEmu works fine on Linux though, in this scaling situation :(
Not sure if this is the same bug as originally mentioned, but I found a reproducible case on Windows.
Repro:
- Have two monitors with different display scaling (tested with 4k at 150% and 1080p at 100%)
- Move the Unity window to a monitor that isn't the "Main Display" and has different display scaling.
- Start ClientSim
- Click/interact
Expected:
- Mouse stays with in the "Game" window and does not click outside of it.
Actual:
- Mouse appears and unfocuses the "Game" window in unity
When both monitors have the same scaling, there are no issues.
- Changing the scaling of the primary monitor from 150% to 100% to match the other monitor does not have the issue.
- Changing the scaling of the secondary monitor from 100% to 150% to match the other monitor does not have the issue.
- Unity does not have issues when it is displayed on the "Main Display"
I want to note that ClientSim was developed on a multi monitor setup with the main screen being 4k with 150% scaling and a 1080p 100% scaling second monitor and this bug never occurred, as the unity window was always on the "Main Display".
@daalta When you have this issue, is your Unity window on the "Main Display" according to Windows?
@CyanLaser It is not! My main display is 1080p, and my secondary monitor is 4k.
My main display is 4k and my secondary is 2048x1152, so they definitely are differently scaled in Windows, but not in linux, it doesn't support per-monitor scaling.