How to disable mouse wheel scroll inside a scrollview?

Hello,

I’m pretty new to Unity and coding in general. I would like to disable the mouse wheel automatic scrolling when in my scrollview. I have looked for this all over the web and can’t seem to find an answer.

I have created a mousedown + mouseposition tracking to update the scrollview Vector2D (which control the position of my scrollview content). This allows me to “drag” the content around. Unfortunately when I use the scroll wheel of the mouse it also updates the Vector2D and consequently moves the content inside.

I tried preventing this by constantly updating the Vector2D, but everytime I scroll with the mouse wheel, you can see 1 frame of scrolling which is definitely not what I am looking for.

Is there any way to prevent the mouse wheel to scroll inside my scrollview? Am I thinking this the wrong way?

Thanks!

You might find this helpful http://answers.unity3d.com/questions/315822/disabling-mouse-wheel-when-user-is-scrolling-scrol.html

Sadly this is not helping. This is in the case of having 2 different scripts, doing 2 different things. When the content of the scrollview is bigger than the rectangle it is inside, the scrollwheel of your mouse will automatically scroll the content. This is what I need to prevent while maintaining all the other controls, and I cannot do this by disabling the script.

1 Answer

1

Hello there,
I know this is old but I couldn’t find many answers about this, and I finally figured out myself a very simple solution.
Just set the “Scroll Sensitivity” field of your Scroll Rect script to 0 (image below).
Cheers!

108870-screenshot.png

Thank you.

cool, works!