How to stop ScrollContainer from not activating Scrollbar and resizing contents to fit in the box

Godot Version

Godot Version 4.2

Question

So I’m following this video to help me know about making menus in Godot. But when I tried to replicate the scroll container, It didn’t work as it was supposed to. Not even the docs or any available information on the internet was able to help me out. :frowning_face:

Could any one please tell me what I’m doing wrong? Here’s what it looks like btw:


As you can see, the box increases it size and expands to take up the space. But in the video (22:10), The squares stay the same and can be scrolled to see more.

Any help would be greatly appreciated. Thanks in advance! :smiley:

1 Like

You are using a HBoxContainer.

H = Horizontal

If you want the items to stack downwards, use a V = Vertical one.

Also, the items you add need to actually reach outside the boundaries of the ScrollContainer for there to be any scroll bar.

So, you’d need to make sure the ScrollContainer has a fixed size and that the content spans wider (since you are using a Horizontal Box Container) than it’s width.

To answer your first point: Yes, I intended to use a HBoxContainer. I’m making a horizontal scroll bar, not a vertical one.

And to answer your 2nd point: That’s the problem I’m having, How do I set the ScrollContainer to a fixed size and increase the HBoxContainer? Only the ScrollContainer is able to set it’s size and scale, but the node cant do it on it’s own

Probably what you want is this. Also the documentation has explanations for how to use controls: User interface (UI) — Godot Engine (stable) documentation in English

I’m not really sure which part of the page your talking about that could help me out, could you directly teach me how it’s done or recommend a video?

Or maybe I’m doing something wrong with the container I don’t really know

Any replies?

How do I access custom_min_size?

No help has really come after the last reply I made, what’s going on?

Please don’t spam with pings, you’re more likely to annoy people by hounding them, they might be busy and not available on weekdays for example

Oh, I’m sorry. I thought maybe people weren’t able to see the topic in other to respond back to it again (if they don’t have notifications) so I tried making it stay on top in the topic page for people to see and respond. I guess I’ll have to till the weekends before my issue can be solved :slightly_frowning_face:

Is it ok for me to ask for help now?

Just wait… You won’t get more help by just repeatedly asking when no one has answered, if no one answers it means either that no one knows or that you haven’t asked in a way that people can help with

Oh alright then, I’ll wait.

My question btw is: How do I make the ScrollContainer bigger than the HBoxContainer?

While inside the ScrollContainer, the HBoxContainers size will expand to fit its contents.
Size the ScrollContainer smaller than the HBox to bring up the scrollbar.

Yeah but, the HBoxContainer keeps changing it’s size when I resize the scroll container. How do I size the ScrollContainer to make it smaller without changing it’s contents. Does it have something to do with my full rect option?

Yes, setting the ScrollContainer LayoutMode to fullrect will prevent the scroll bars from appearing.
In the inspector under Layout find LayoutMode and reset it.
Then resize the ScrollContainer.

I’ve resized the ScrollContainer with the Postion layout mode, but the resizing thing is still the same. What do I do now?

Select the ScrollContainer, use the grab bar to drag the size much smaller and take a screen shot.
The scroll bar should be there.

Am I doing it right?