using UnityEngine; using UnityEngine.UI; public class BTN_OptionsVsync : MonoBehaviour { [HideInInspector] public Toggle toggle; private RenderSettingsMy renderSettings; private void OnEnable() { if (toggle == null) { toggle = GetComponent(); } if ((bool)GlobalSettings.Instance) { renderSettings = GlobalSettings.Instance.renderSettings; toggle.isOn = renderSettings.useVsync; } } public void ValueChanged() { if ((bool)renderSettings) { renderSettings.useVsync = toggle.isOn; renderSettings.RefreshVsync(); } } }