Nodes clipped by ScrollContainer keep interactable even if not showing

Godot Version

4.3-stable

Question

So, in my game I have a ScrollContainer with a VBoxContainer inside it that gets populated with buttons (they are custom ones, not the default Godot UI buttons)

My issue is that I can keep interacting with the buttons even if they are not showing (clipped by the ScrollContainer)

Both ScrollCantainer and VBoxContainer have “clip contents” set to true
I also tried putting everything inside a basic Control node and setting its “clip contents” to true but it did nothing
I tried setting “clip children” to clip only and it did nothing as well
I saw a solution by setting func _clips_input(): return true on the container and it didn’t work, also saw another solution by setting get_viewport().set_input_as_handled() on a different Area2D as a sort of “mask” and it didn’t work either

I’m not the most tech guy, so I might be dumb, but from what I’ve searched this shouldn’t be an issue?

what does that even mean?

buttons have to be buttons. and everything that is child of a Control inherited node has to also be a Control inherited node. if you mix Controls and Node2Ds and just hide them, these things can happen. because physics objects are not disabled just because they are not visible, they are separate from the visual part, that’s why we can have invisible walls.

read the above. don’t use Node2Ds for UI. if you do you have to code everything from scratch.

1 Like

It’s a PackedScene with a Control root with some Labels, NinePatchRect, Sprites and a script to make the button that gets instantiated and put as a child of the VBoxContainer

I didn’t realize that 2D nodes would cause so much conflict inside Control nodes, I was using an Area2D with CollisionShape2D to detect the mouse entering and exiting the button, guess this was the issue, I took them off and used the default Control’s _on_mouse_entered and _on_mouse_exited for that and it worked like a charm

And I know I was doing things the hard way around, but guess when I started learning Godot this was the way I figured to detect mouse hover and didn"t even question a better solution for different situations (also, this was a game jam project that I’m polishing up, so things are a bit messy all round)

Thanks for the help