HScrollBar instead of VBoxContainer added

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Droggelbecher

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?

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.

njamster | 2020-09-05 12:12

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.

Droggelbecher | 2020-09-06 17:16