Scroll Container won't scroll

Godot 4

I’m trying to add instances of nodes to a scroll container so that when enough are added to the UI the player can scroll to see them all.

the nodes I’m adding are structured like this:

CollisionShape2d (needed elsewhere in game, may be changed to CollisionShape)
|__Sprite

the scene I’m adding them to is structured like this:

ScrollContainer
|__VBoxContainer

only property I’ve changed is layout_mode to Anchors/Full Rect on the ScrollContainer, otherwise nothing displays at all

I’ve followed a couple tutorials and they make it seem like they just work, but in my case there’s no difference between having the ScrollContainer or not, game behaves exactly the same, cutting off the nodes added beyond the limits of the container

ScrollContainer is used only for Control nodes.
You are using CollisionShape2d, which is derived from Node2D and not from Control.
So basically the ScrollContainer doesn’t recognize the CollisionShape2d, because it is not a Control-node.

Mixing Control-nodes and Node2D-nodes is in most cases not a good idea.

Use Control-nodes for GUI elements.
Use Node2D-nodes for game elements (physics, …).

that makes sense, is there a way I can “stack” a bunch of nodes and have the ability to scroll when the stack gets too tall to fit?

Edit:

Figured it out, instead of adding instances of the functional node to the ScrollContainer, I add a TextureRect node and assigning the texture from the functional node instead

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.