using UnityEngine; using UnityEngine.UI; public class BTN_OptionsTensionBar : MonoBehaviour { public HUDFishing.TensionWidgetType tensionWidgetType; [HideInInspector] public Toggle toggle; private PlayerSettingsMy playerSettings; private void OnEnable() { if (toggle == null) { toggle = GetComponent(); } if ((bool)GlobalSettings.Instance) { playerSettings = GlobalSettings.Instance.playerSettings; if (tensionWidgetType == playerSettings.tensionWidgetType) { toggle.isOn = true; } } } public void ValueChanged() { if ((bool)playerSettings && toggle.isOn && tensionWidgetType != playerSettings.tensionWidgetType) { playerSettings.SetTensionWidgetType(tensionWidgetType); } } }