- Home /
Resolutions are different in standalone build
Hi all,
I have this code to handle a dropdown to change resolution in my game :
resolutions = Screen.resolutions;
resolutionsDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResolutionIndex = 0;
foreach (Resolution resolution in resolutions)
{
string strResolution = resolution.width + " x " + resolution.height;
if (!options.Contains(strResolution))
{
options.Add(strResolution);
if (resolution.width == GameManagerSingleton.Instance.GameConfig.Resolution[0] &&
resolution.height == GameManagerSingleton.Instance.GameConfig.Resolution[1])
{
currentResolutionIndex = Array.IndexOf(resolutions, resolution);
}
}
}
resolutionsDropdown.AddOptions(options);
resolutionsDropdown.value = currentResolutionIndex;
resolutionsDropdown.RefreshShownValue();
It's working perfectly fine in unity editor when the scene is loaded my current resolution (1920*1080) is selected in the dropdown. But when I build & run the game, when the scene is loaded, the resolution 1360*768 is selected...
Any ideas? Thanks
Which version of Unity are you using? Old versions had the "Display Resolution Dialogue" setting in the Player -> Resolution and Presentation settings -- it caused user settings to be stored in the registry, which could make it tricky to debug new versions which changed resolution approaches (as it might override what you thought was being set). This setting is now Deprecated and disappeared. Also, you may want to check if your "Default is native resolution" option is ticked or not in the settings.
I found the issue,
I'm filtering the resolution to prevent double value. So that's why the indexes are different ^^
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Player Settings Standalone resolution will not change? 0 Answers
Camera Changes Proportions In Build 1 Answer
"Couldn't switch to requested monitor resolution" 1 Answer
Objects off screen after build 0 Answers