- Home /
Question by
Ahmad_aglan993 · Jan 31, 2017 at 10:04 AM ·
slidervalueinteractable
Slider is not interactable if I set the value from script
I set the slider value incremented from script this makes the slider not interactable during runtime
this my code for this
Seeker.minValue = 0;
Seeker.maxValue = GetDuration();
progress = Mathf.Lerp(0, Seeker.maxValue, m_iCurrentSeekPosition / Seeker.maxValue);
SliderTxt.text = progress.ToString();
Seeker.interactable = true;
Seeker.value = progress;
Comment
Answer by Hellium · Jan 31, 2017 at 10:03 AM
It's because you set the value of the slider each frame, overriding the input of the user.
Detect the
OnPointerDown
event on the slider and disable the update of the value (a simple boolean with a condition will be enough)Detect the
OnPointerUp
event on the slider and enable back the update of the value
To detect these events, use the EventTrigger
component using the inspector or do it all by code :
Your answer
![](https://koobas.hobune.stream/wayback/20220612105932im_/https://answers.unity.com/themes/thub/images/avi.jpg)