Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Couldn't switch to requested monitor resolution

Discussion in 'Editor & General Support' started by BjornVTI, Sep 11, 2012.

  1. BjornVTI

    BjornVTI

    Joined:
    Sep 11, 2012
    Posts:
    7
    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:
    Code (csharp):
    1.  
    2. void Awake() {
    3.     Screen.SetResolution(1920, 1080, false);
    4. }
    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?
     
  2. BjornVTI

    BjornVTI

    Joined:
    Sep 11, 2012
    Posts:
    7
    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...
     
  3. BjornVTI

    BjornVTI

    Joined:
    Sep 11, 2012
    Posts:
    7
    I found a workaround, by making my application wait for short while after setting the new resolution I got rid of the error.
    Code (csharp):
    1. IEnumerator Start () {
    2.     Screen.SetResolution(1920, 1080, false);
    3.     // Wait for new screen resolution to take effect
    4.     yield return new WaitForSeconds(1);
    5. }
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Be sure to submit a bug report, that way UT can take a look at this.