private void RemoveHandlers(Slider slider) { SliderCallbacks callback = slider.GetComponent <SliderCallbacks>(); if (callback != null) { callback.OnEndDragCallback -= OnEndDrag; callback.OnEnterCallback -= OnEnter; callback.OnExitCallback -= OnExit; } }
private void AddHandlers(Slider slider) { SliderCallbacks callback = slider.GetComponent <SliderCallbacks>(); if (callback == null) { callback = slider.gameObject.AddComponent <SliderCallbacks>(); } callback.OnEndDragCallback += OnEndDrag; callback.OnEnterCallback += OnEnter; callback.OnExitCallback += OnExit; }