using UnityEngine; using UnityEngine.UI; public class BTN_OptionsUnderwaterDistortion : 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.underwaterDistortion; } } public void ValueChanged() { if ((bool)renderSettings) { renderSettings.underwaterDistortion = toggle.isOn; } } }