public void SaveSettings() { var settingsApplyer = FindObjectOfType <PlayerSettingsApplier>(); SettingsData settingsFromMenu = GetSettingsFromMenu(); if (settingsApplyer) { settingsApplyer.ApplySettings(settingsFromMenu); } else { Debug.LogWarning("There is PlayerSettinsApplyer in the scene"); } PlayerSettingsApplier.SaveSettingsData(settingsFromMenu); }
public void SavesSettingsData() { SettingsData settings; settings = new SettingsData() { isFullscreen = 1, masterVolume = 10f }; PlayerSettingsApplier.SaveSettingsData(settings); Assert.AreEqual(1, PlayerPrefs.GetInt(PlayerSettingsApplier.FullscreenTag)); Assert.AreEqual(10f, PlayerPrefs.GetInt(PlayerSettingsApplier.MasterVolumeTag)); settings = new SettingsData() { isFullscreen = 0, masterVolume = -10f }; PlayerSettingsApplier.SaveSettingsData(settings); Assert.AreEqual(0, PlayerPrefs.GetInt(PlayerSettingsApplier.FullscreenTag)); Assert.AreEqual(-10f, PlayerPrefs.GetInt(PlayerSettingsApplier.MasterVolumeTag)); }