How to identify which controls are currently visible within ScrollContainer?

Godot Version

v4.3.dev6.official [64520fe67]


Suppose I have a ScrollContainer containing a GridContainer with 100 buttons, displaying only 10 buttons at a time. How can I determine which buttons are visible within the ScrollContainer? Is there a way for each button to notify me when it becomes visible, similar to the VisibleOnScreenNotifier nodes but for controls?


  1. CanvasItem — Godot Engine (stable) documentation in English ↩︎

@Sweatix This solution doesn’t work because all 100 buttons within the ScrollContainer will have the ‘visible’ property set to true, even though only 10 are visible on the screen. I want to identify which buttons within the ScrollContainer are actually displayed on screen.

Oh, my bad.

I just scoured the Godot Docs and I couldn’t find any native support for your use case. I guess you could just compare a button’s transform to that of the container to determine its visibility? I don’t have much experience with Controls just yet so that’s my best guess.