// Load the settings from the previous game public void loadSettings() { gameset = JsonUtility.FromJson <gamesettings>(File.ReadAllText(Application.persistentDataPath + "/gamesettings.json")); fullT.isOn = gameset.fullscreen; ResolutionD.value = gameset.resolution; TextureD.value = gameset.TexttureQuality; antiaDrop.value = gameset.antia - 1; VDrop.value = gameset.vsink; MusicVol.value = gameset.music; Screen.fullScreen = gameset.fullscreen; ResolutionD.RefreshShownValue(); }
private void OnEnable() { gameset = new gamesettings(); //call code on change fo options fullT.onValueChanged.AddListener(delegate { onFull(); }); ResolutionD.onValueChanged.AddListener(delegate { OnresChange(); }); TextureD.onValueChanged.AddListener(delegate { OntextureChange(); }); antiaDrop.onValueChanged.AddListener(delegate { OnAAChange(); }); VDrop.onValueChanged.AddListener(delegate { OnvsinkChange(); }); MusicVol.onValueChanged.AddListener(delegate { OnmusicvolChange(); }); done.onClick.AddListener(delegate { onapplybuttonclick(); }); resolutions = Screen.resolutions; foreach (Resolution res in resolutions) { ResolutionD.options.Add(new Dropdown.OptionData(res.ToString())); } loadSettings(); }