I am developing my application on a double screen system with two 1280x1024 monitors on Windows.
I am trying to set a windowed resolution of 1920x1080 by doing:
void Awake() {
Screen.SetResolution(1920, 1080, false);
}
When I run the application in DirectX mode I get:
But if I run the application with the -force-opengl option it works properly. I.e. opens a window with 1920x1080 resolution.
Any ideas how to solve this?
If I set the player to use 1920x1080 resolution it works.
But if I then use Screen.SetResolution(1920, 1080, false) to set the resolution, the program reports the same error as above.
Worth noting is that I use the low-level-native plugin, so I suspect that some event in the UnitySetGraphicsDevice() function is not done correctly…
I found a workaround, by making my application wait for short while after setting the new resolution I got rid of the error.
IEnumerator Start () {
Screen.SetResolution(1920, 1080, false);
// Wait for new screen resolution to take effect
yield return new WaitForSeconds(1);
}
Be sure to submit a bug report, that way UT can take a look at this.