- Home /
Screen width and height and resolution
This doesn't make sense to me. My LED Monitor has a resolution of 1920 x 1080. In the build player settings I have Default is Full Screen = true, Default is Native resolution = true.
Here is my code:
Debug.Log("screen width: " + Screen.width + " " + "screen height: " + Screen.height);
foreach(var res in Screen.resolutions)
{
Debug.Log(res.width + " " + res.height);
}
Here is the output:
screen width: 1616 screen height: 909 UnityEngine.Debug:Log(Object)
640 480 UnityEngine.Debug:Log(Object)
I get the screen height and width it what it gives me inside the editor set to 16:9 but how is the resolution 640 X 480????
If I am changing a GUITexture layout based on resolution should I check the Screen height and width or the screen resolution??
Thnaks in advance!
Answer by mscarter · Feb 19, 2014 at 06:08 PM
Screen.resolutions enumerates the possible resolutions of the display. I think you want to use Screen.height and Screen.width to determine the current size of the rendering window.
Screen.currentResolution can be used to determine the active resolution as well, but this will tell you the resolution of the screen, not the size of the rendering window.
Your answer
