Code (CSharp): List<string> options = new List<string>(); resolutions = Screen.resolutions; 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.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) currentResolutionIndex = i; } resolutionDropdown.AddOptions(options); resolutionDropdown.RefreshShownValue(); if (PlayerPrefs.GetFloat("ÇözünürlükX") == 0) { resolutionDropdown.value = options.Count; } else { resolutionDropdown.value = options.IndexOf(PlayerPrefs.GetFloat("ÇözünürlükX") +" x "+ PlayerPrefs.GetFloat("ÇözünürlükY")); } With this code i am getting resolutions but they are coming by duplicated values. Like there is 2 1920*1080. I looked at many thread at Unity. They didn't worked for me. How can i fix this?
They're probably different refresh rates. Check that field. Also, this: You should consider centralizing to avoid typos. It should also be an integer, not a float. Here's an example of simple persistent loading/saving values using PlayerPrefs: https://gist.github.com/kurtdekker/01da815d2dfd336a925ae38019c3a163 Useful for a relatively small number of simple values.
yeah its because there are different refresh rates. If you dont want duplicate resolution size, you can do this: Code (CSharp): resolutions = Screen.resolutions.Where(resolution => resolution.refreshRate == 60).ToArray();
Np, it grabs only screen resolutions that are refresh rate of 60, but you can change that value if u would like.