- Home /
Question by
ByteVault · Nov 19, 2014 at 04:18 PM ·
resolutionscreensettingsfix
Minimum resolution fix? [Solved]
HI, I'm trying to get the game set a minumum screen resolution by checking if the resulution is less than 1024x768 and if it is lesser than, change it to.. It also gets the information about fullscreen so that you will not be forced to have fullscreen on.
However, seems this does not work since when I pick 1920x1080 it changes it back to 1024x768 anyway?
C# script:
Resolution[] resolutions2 = Screen.resolutions;
foreach (Resolution res in resolutions2) {
//print(res.width + "x" + res.height);
if (res.width < 1023 || res.height < 768){
if(Screen.fullScreen == true)
{
Screen.SetResolution(1024, 768, true);
}
else if(Screen.fullScreen == false)
{
Screen.SetResolution(1024, 768, false);
}
}
}
Any fix? Would be awesome if anyone had a solution for me!
dns Had the solution: Screen.width instead of res.width.
Thanks!
Comment
Hi, shouldn't you test with "Screen.width" that is the current resolution before going through the available resolutions and pick one ?
Your answer
![](https://koobas.hobune.stream/wayback/20220613171924im_/https://answers.unity.com/themes/thub/images/avi.jpg)