Unity not scrolling when mouse not over object

Unity not scrolling when mouse not over object

In Unity I am using a scroll view. It works semi-perfectly (had a lot of problems with it, don't like how the UI system works).
The content for my scroll view is a bunch of buttons aligned vertically with some spacing between them. The problem is that the scroll rect will only scroll if I'm hovering over one of the buttons. If the mouse is between two buttons, it won't scroll.
Here are some screenshots:



Also, you may see that I'm not using the standard Scroll Rect, mine is nothing special, just disabled the dragging that is stupid to be used on non-touch devices.

Solutions/Answers:

Answer 1:

ScrollView by default has an Image component with a RaycastTarget enabled like on the image below.

enter image description here

In order to detect touch and clicks, UI elements need to have at least one component with RaycastTarget enabled.

Your ScrollView doesn’t have the default Image background so it doesn’t respond to clicks. Add Image component to your ScrollView so it looks like a background and tick RaycastTarget. Set it’s color opacity to 0f and voilà 🙂

References