Esempio n. 1
0
    public void ChangeResolution()
    {
        TMPro.TMP_Dropdown dropdown = GameObject.Find("ResolutionDropdown").GetComponent <TMPro.TMP_Dropdown>();
        List <Resolution>  list     = dropdown.GetComponent <GetResolutions>().list;

        Resolution res = list[dropdown.value];

        bool fullscreen = Screen.fullScreen;

        Screen.SetResolution(res.width, res.height, fullscreen);

        PlayerPrefs.SetInt("Width", res.width);
        PlayerPrefs.SetInt("Height", res.height);
        PlayerPrefs.SetInt("Hz", res.refreshRate);
        PlayerPrefs.Save();
    }