- Home /
Detect when user clicks VerticalSlider?
I am using a VerticalSlider control to get feedback from a user in Unity. I know how to detect when the user changes the value of the slider.
However, I can't seem to figure out a way to detect if the user just clicks on the current position of the slider if he doesn't want to move it. I would like to avoid adding other visual controls.
Is there any way to detect when the user clicks on the slider thumb but doesn't move it?
Answer by franky303 · Sep 29, 2012 at 05:27 PM
In your OnGUI function, try checking if ( Event.current.type == EventType.MouseDown ) and if yes, check if the click was inside the rect of your control, you can do it with Rect.Contains(Event.current.mouseposition) ...
Your answer
Follow this Question
Related Questions
'MouseLook.sensitivityX' is inaccessible due to its protection level. 2 Answers
How do you get Old OnGUI Scripts to work with the New UI Scrollbars? 0 Answers
how to control SMOOTHNESS via GUI slider?! It's not working...pls help! 1 Answer
How to draw slider thumb on top 0 Answers
Wider Slider GUI graphic 1 Answer