OK so I am making a small clicker game and I am currently working on getting a settings menu to work and I have been having some issues. The issues are
A. the drop down menu in the editor and when i build it are different (in editor i have everything, in a build i have 4)
B. When I build the game it is really blurry and the wrong resolution all together.
here is the code
when the commented out for loop is not commented the resolution will change to the wrong one and make it blurry currently im manually changing it in the start.
private Resolution[] resolutions;
private List<Resolution> filteredReso;
[SerializeField] TMP_Dropdown resoDropdown;
[SerializeField] Toggle fullScreen;
private RefreshRate currentRefreshRate;
private void Start()
{
resolutions = Screen.resolutions;
filteredReso = new List<Resolution>();
currentRefreshRate = Screen.currentResolution.refreshRateRatio;
resoDropdown = GetComponentInChildren<TMP_Dropdown>();
fullScreen = GetComponentInChildren<Toggle>();
fullScreen.isOn = Screen.fullScreen;
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, Screen.fullScreen);
DropdownStart();
}
private void DropdownStart()
{
resoDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResolutionidex = 0;
for (int i = 0; i < resolutions.Length; i++)
{
if (resolutions[i].refreshRateRatio.value == currentRefreshRate.value)
{
filteredReso.Add(resolutions[i]);
//Debug.Log(resolutions[i].ToString());
}
}
/*for (int i = 0; i < filteredReso.Count; i++)
{
string option = filteredReso[i].width + " x " + filteredReso[i].height;
options.Add(option);
if (filteredReso[i].width == Screen.width && filteredReso[i].height == Screen.height)
currentResolutionidex = i;
}*/
resoDropdown.AddOptions(options); //puts all the options into the dropdown
resoDropdown.value = currentResolutionidex; //makes the drop down menu value to index
resoDropdown.RefreshShownValue(); //resets the dropdown to the current resolution
}