Screen resolution understanding issue

Code:

    Screen.SetResolution(800, 600, true);
    print("screen width " + Screen.width);
    print("screen height " + Screen.height);

Based on my understanding of the documentation, this should return 800*600. Yet I get 890*667 or whatever my editor is manually sized to. So my question is what does Screen.SetResolution actually do if it doesn't set the resolution? Is there another way to set resolution?

Thanks in advance!

Inside the editor you can't get the right result, because your "game-resolution" affects only a window inside the editor. Since the Game-window-tab is docked into the editor it can't change to any size you want. If you make a build it should work.

(if you undock the game-tab it should work too [not tested])

Here’s what I know after playing a little with resolution, perhaps it’ll be of use:

-The editor window doesn’t adapt itself like the build does.

-Using Screen.SetResolution(width,height,fullScreen) will adapt itself to the closest supported aspect ratio, which you can change within Build Settings>Player Settings.

-You can set the default game window width and height in the Player Settings and choose to disable the Resolution Dialog.

-Whenever reading Screen.width and Screen.height, you’re actually reading the game window resolution. To read the actual screen area, use Screen.currenResolution.width and Screen.currentResolution.height - documentation says it only works in window mode.

-As a sidenote, you can use the commandline -popupwindow to remove the frame in window mode.