I read this. But simply changing “UnitySelectMonitor” Player Pref only works after restarting the game.
I have arrow buttons to let the user change to the previous or the next available monitor.
Here is the code example for the next monitor button.
public Resolution[] resolutions;
public int curRes;
public int curMonitor = 0;
public int curWidth, curHeight;
public bool curFullscreen = true;
public void nextMonitor()
{
curMonitor++;
//checking if there is another monitor
if (curMonitor > Display.displays.Length - 1)
curMonitor = 0;
//setting PlayerPref
PlayerPrefs.SetInt("UnitySelectMonitor", curMonitor);
//calculating available resolutions
resolutions = Screen.resolutions;
curRes = resolutions.Length - 1;
//sets the best resolution
curWidth = resolutions[curRes].width;
curHeight = resolutions[curRes].height;
Screen.SetResolution(curWidth, curHeight, curFullscreen);
}
Here are my PlayerSettings: