[Solved] Screen.resolutions returning duplicates

In the editor, Screen.resolutions functions as expected. The problem is on standalone where it appears to duplicate each resolution with refresh rates of 60Hz and 48Hz. Is there any way to only use 60Hz refresh rates or completely omit refresh rates when getting Screen.resolutions?

This is the Screen.resolutions log when cycling through resolutions:
1920 x 1080 @ 60Hz
1920 x 1080 @ 48Hz
1680 x 1050 @ 60Hz
1680 x 1050 @ 48Hz
1600 x 900 @ 60Hz
1600 x 900 @ 48Hz
And so on…

You can filter out all non-60hz results after calling the function.

A Linq statement like this would work:

var resolutions = Screen.resolutions.Where(resolution => resolution.refreshRate == 60);

Either way - remember that the hz number is not unimportant. Especially for people using monitors that go above 60hz.

Also: You might have different results on different computers. My test just gave me a lot of resolutions, but none of them were 60hz. So if you want to just have unique height and width results, filter for that.

var resolutions = Screen.resolutions.Select(resolution => new Resolution { width = resolution.width, height = resolution.height }).Distinct();

Be aware that this statement will delete the hz info completely.

Remember to use

using System.Linq;

More and more high refresh rate monitors are being used. Keeping the player stuck at 60Hz is not good. This method filters out low refresh rates.

public static List<Resolution> GetResolutions() {
    //Filters out all resolutions with low refresh rate:

    Resolution[] resolutions = Screen.resolutions;
    HashSet<Tuple<int, int>> uniqResolutions = new HashSet<Tuple<int, int>>();
    Dictionary<Tuple<int, int>, int> maxRefreshRates = new Dictionary<Tuple<int, int>, int>();

    for (int i = 0; i < resolutions.GetLength(0); i++) {
        //Add resolutions (if they are not already contained)
        Tuple<int, int> resolution = new Tuple<int, int>(resolutions_.width, resolutions*.height);*_

uniqResolutions.Add(resolution);
//Get highest framerate:
if (!maxRefreshRates.ContainsKey(resolution)) {
maxRefreshRates.Add(resolution, resolutions*.refreshRate);*
} else {
maxRefreshRates[resolution] = resolutions*.refreshRate;*
}
}
//Build resolution list:
List uniqResolutionsList = new List(uniqResolutions.Count);
foreach (Tuple<int, int> resolution in uniqResolutions) {
Resolution newResolution = new Resolution();
newResolution.width = resolution.Item1;
newResolution.height = resolution.Item2;
if(maxRefreshRates.TryGetValue(resolution, out int refreshRate)) {
newResolution.refreshRate = refreshRate;
}
uniqResolutionsList.Add(newResolution);
}
return uniqResolutionsList;
}