0 votes

Hi there!
I'm trying to use the Scroll Container but it doesn't seem to be detected that there are things inside of it (it's not making the scroll bar on the side) I'm using button's inside a Vbox maybe that's why but I can't seem to figure it out.

my scene tree :

Big thanks for the help!

Godot version Godot v3.4.4
in Engine by (99 points)

It could be the child's size ~ in this case the VBox container ~ double check the orange rectangle is wrapping all the children and that the size-flags and layout is set correctly

Hey there! thanks for the response,
But I'm confused about what you mean by the child's size is off but here is my scene I'm trying to get to work - https://imgur.com/a/Onj6O0R

Ah thanks for the video, easier to see what's happening.
Making UI in Godot can be tricky so it could be a number of things, but I'll list a couple potential solutions:

  • The ScrollContainer needs to be smaller than its children, so make the ScrollContainer the size you want it and then let the children (e.g. VBoxContainer) be larger than the ScrollContainer
  • Using Layout can help when dealing with UI, you can make the container Full Rect layout to make its max height and width the same as the viewport

Lmk how you go :)

Came across a similar issue that I was able to solve. In my case, even though I was adding a ton of content to my HBox (that was inside a scroll container and without clipping enabled), the size reported in Remote (debugger) was the same size as the gridcontainer which is unexpected. The HBox should have been way bigger. I ended up having to measure the width of all children in my HBox and then set the HBox min_size to the combined total. For me, I did this on resize but it could be done on add or wherever.

To see if this is your issue, look at remote and compare your gridcontainer dimensions with it's top control node dimensions. If they are the same, this is likely the problem.

1 Answer

0 votes

In order to calculate layout for its elements, containers need some information about those elements. Control type has got the API used for relaying this information. All contents of your Containers that you want displayed should extend Control. Purely non visual nodes like AudioPlayers etc are fine, but all visual elements should be Controls. You will have to figure out how to put together what you want from Controls or write a custom Control node.

by (14 points)

so does that mean I cant use touchscreenbuttons with a scroll container scene tree - https://imgur.com/a/M7uAQLN or do I have to make them all children on control nodes which I just tried without success but ill continue to see if it is the fix.

any whom big thanks for the help!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.