Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2020.3

2020.3.22f1

2021.2

2022.1

Issue ID

1384876

Regression

No

Main Player window is moved to the primary display when it's launched on a 3rd monitor and the 2nd monitor is activated

Windows

-

Main Player window is moved to the primary display when it's launched on a 3rd monitor and a 2nd monitor is activated with Display.Activate()

How to reproduce:
1. Have 3 monitors connected
2. On the Desktop, create a new Shortcut (Right-click > New > Shortcut)
3. Click "Browse" and navigate to the location of the attached build's "monitor" executable "monitor.exe"
4. Add the argument " -monitor 3" to the end of the executable's location
5. Click "Next" and "Finish"
6. Launch the newly created Shortcut

Expected result: The Player is launched and stays on the 3rd monitor
Actual result: The Player is launched on the 3rd monitor and moves to the primary monitor

Reproducible with: 2019.4.33f1, 2020.3.24f1, 2021.2.5f1, 2022.1.0b1

  1. Resolution Note:

    This is by design. When using multi-display API, each window gets assigned their own display and primary window will always get assigned the primary display. Otherwise, you could get into situation where the one of the displays has two windows on it and the primary display has none.

    If you don't like this behaviour, you can work around it in your scripts:

    1. Before calling display.Activate(), call GetWindowRect() Windows API to find window position;
    2. display.Activate() displays;
    3. Wait 1 frame;
    4. Call SetWindowPos() Windows API with coordinates obtained from GetWindowRect() to restore the desired position.

    In Unity 2021.2, you can use Screen.MoveMainWindowTo() API instead.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.