diff --git a/Assets/Scripts/Graphics/TargetFrameRate.cs b/Assets/Scripts/Graphics/TargetFrameRate.cs index b3836d1..e6e8f50 100644 --- a/Assets/Scripts/Graphics/TargetFrameRate.cs +++ b/Assets/Scripts/Graphics/TargetFrameRate.cs @@ -5,12 +5,12 @@ using TMPro; public class TargetFrameRate : MonoBehaviour { - void Awake () { - // Its a dead simple app. There's no need for 120 fps - // By default the vSyncCount is 2 (1/2 of max fps, ex. 120/2 = 60) - - QualitySettings.vSyncCount = PlayerPrefs.GetInt("vSyncRate", 2); - Application.targetFrameRate = PlayerPrefs.GetInt("fpsTarget", 0); + // Its a dead simple app. There's no need for 120 fps + // By default the vSyncCount is 2 (1/2 of max fps, ex. 120/2 = 60) + + QualitySettings.vSyncCount = PlayerPrefs.GetInt("vSyncRate", 2); + // fpsTarget is saved as a dropdown value, e.g. 3 for 30fps + Application.targetFrameRate = PlayerPrefs.GetInt("fpsTarget", 0) * 10; } } diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index 36a833e..7d0ce46 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -1,4 +1,4 @@ -using TMPro; +using TMPro; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; @@ -24,38 +24,20 @@ void Awake() { public void SetVSyncRatio(System.Int32 value) { - // Clear fpsTarget - PlayerPrefs.SetInt("fpsTarget", 0); - fpsTarget.value = 0; - Application.targetFrameRate = -1; - - if (value == 0) - { - SetFpsTarget(3); - } - PlayerPrefs.SetInt("vSyncRate", value); - vSyncRate.value = value; - QualitySettings.vSyncCount = value; + + if (value != 0) + fpsTarget.value = 0; } public void SetFpsTarget(System.Int32 value) { - // Clear vSync Count - PlayerPrefs.SetInt("vSyncRate", 0); - vSyncRate.value = 0; - QualitySettings.vSyncCount = 0; - - if (value == 0) - { - SetVSyncRatio(2); - } - PlayerPrefs.SetInt("fpsTarget", value); - fpsTarget.value = value; - Application.targetFrameRate = value != 0 ? value * 10 : -1; + + if (value != 0) + vSyncRate.value = 0; } void LateUpdate() {