- Home /
how to change resolution in dropdown?
All the resolutions appear in the dropdown box but nothing actually changes.
public Dropdown resolutionDropdown;
Resolution[] resolutions;
void Start()
{
resolutions = Screen.resolutions;
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResolutionIndex = 0;
for(int i=0; i <resolutions.Length; i++)
{
string option = resolutions[i].width + " x " + resolutions[i].height;
options.Add(option);
if(resolutions[i].width == Screen.width && resolutions[i].height == Screen.height)
{
currentResolutionIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = currentResolutionIndex;
resolutionDropdown.RefreshShownValue();
}
public void SetResolution(int resolutionIndex) { Resolution resolution = resolutions[resolutionIndex]; Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen); }
Answer by Chocolade · Dec 01, 2019 at 05:18 PM
It's working fine. You need to build first your game and then run the exe file and make the changes from there. I just tested it my self now.
In the editor : File > Build Settings... > Add Open Sscenes (First add the Main Menu scene or if you have only one scene then the one scene you have ).
Then just click on the button Build it will ask you for a folder where to create the exe file. Then run this exe file and try from there from inside the game.
Your answer
Follow this Question
Related Questions
How to make a refresh rate dropdown menu? 1 Answer
I built a test and the resolution dropdown is not working, why? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Remove specific screen resolutions 0 Answers