If you look at the diagram here,

you can see that Area2D input events are handled last. I did find a solution, though.
- Set mouse filter to ignore on scrollcontainer
- add an area2d and a collisionshape2d to the scrollcontainer (the collisionshape2d will only be inside the scrollcontainer so don't worry about getting the size exactly right)
- connect
input_event
signal from area2d to scrollcontainer
- put this code:
extends ScrollContainer
const SCROLL_SPEED = 12
func _on_Area2D_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_WHEEL_DOWN:
scroll_vertical += SCROLL_SPEED
elif event.button_index == BUTTON_WHEEL_UP:
scroll_vertical -= SCROLL_SPEED
If you want the scrollcontainer to be able to scroll from anywhere and not just when your mouse is over it, don't bother with the area2d and just put the code under the _unhandled_input
function. If you want a reversed scroll direction (scroll up and the scroll bar goes down) just reverse the if statements.