0 votes

Hi there,

when i try to add a VBoxContainer node as a child to a ScrollContainer node, Godot adds a HScrollBar node instead.


How can i add a VBoxContainer instead?

in Engine by (37 points)

I cannot reproduce that! Can you provide an example project? How did you determine that? By looking at the remote tree while the game runs? Note that a HScrollBar and VScrollBar will be added to any ScrollContainer-node by default and nodes instanced via code will be renamed to something like "@@2" unless you provide true as second argument of add_child or manually provide a name for them.

Oh, thanks for the clue! I didn't realize that a ScrollBar will be added automatically. This explains my problem, because i tried to retrieve the node with get_child(0). This must have been the ScrollBar, while the BoxContainer is at position 1.

Please log in or register to answer this question.

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.