- Home /
 
               Question by 
               Kim-Nobre · May 11, 2019 at 03:03 PM · 
                resolutionscreenfullscreenwindowed  
              
 
              Screen.SetResolution doesn't work when the game starts windowed?
I made a simple options menu that has two dropdowns, one to change the window mode to either Fullscreen or Windowed and one to choose the resolution. I use this to find the supported resolutions:
     private void GetSupportedResolutions()
     {
         Resolution[] supportedResolutions = Screen.resolutions;
 
         foreach (Resolution resolution in supportedResolutions)
         {
             width.Add(resolution.width);
             height.Add(resolution.height);
             resolutions.Add($"{resolution.width}x{resolution.height}");
         }
 
         resolutionDropdown.AddOptions(resolutions);
     }
And I call this method through the OnValueChanged() event in the dropdowns:
     public void SetResolution()
     {
         isFullscreen = windowModeDropdown.value == 0;
 
         int i = resolutionDropdown.value;
 
         Screen.SetResolution(width[i], height[i], isFullscreen);
     }
Everything works fine if the game starts in fullscreen, but if it starts windowed, NOTHING works. The resolutions dropdown options stay empty and the window mode dropdown stops working as well. Am I using the "Screen" class the wrong way? Or is it something else?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                