I'm not entirely sure what you want to happen here. As a test, I replicated your scene tree and adjusted my ScrollContainer
width to display 3 of my 4 TextureRects
. With that setup, I have a horizontal scrollbar that will let me scroll to see the 4th TextureRect
.
Additionally, I added a button to the scene that, when pressed, toggles the visibility of the 4th TextureRect
.
The first press of the button hides the 4th item which, in turn, causes the scrollbar of the ScrollContainer
to disappear as it's not needed to display the 3 visible items.
Pressing the button again makes the 4th item visible, and the scrollbar returns as it's now needed to see the 4th item.
It almost sounds like you want want the geometry (size) of the ScrollContainer
to change to fit its contents, but then you'd never need to "scroll".
Generally, you'd want the container to stay the size you've set it and for it to either have (or not have) a scrollbar to see its full contents. In my above experiment, that's exactly how it works.