Vbox Container not Recognizing my Nodes

Godot Version

Godot_v4.2.1

Question

For context, I am making a customization system akin to Sims 4 or Baldur’s gate and need to be able to scroll through the long list of cosmetic items within each tab.
I have been following along with some tutorials on making scroll containers but for some reason when I go to add my children to the VboxContainer, it doesn’t add the scroll wheel like it should and doesn’t let me scroll with my mouse or emulated touch either. However, when I tested the same structure with a few duplicated label nodes that were intentionally too big to fit, the scroll wheel showed up and it let me scroll through the label nodes.
image


(The buttons with white hair are a template for additional cosmetic options)
Each cosmetic option has a sprite2D node with a PNG as it’s texture, and a button underneath the “thumbnail” to instance in the cosmetic onto the player model.

Is this a problem with the node structure?

For extra context, I used these two tutorials!

Thank you for reading!

You are mixing Control-based nodes and Node2D-based nodes.
VBoxContainer only handles Control-based nodes.

So basically in your scene tree, the VBoxContainer ignores all *PVW* nodes.

Mixing Control nodes and Node2D nodes is in most situations not a good option.

2 Likes

I am at a bit of a loss. I thought by making a control node a root of the template, I would be able to scroll through, but when I try to place them, they all get stuck in a corner, and I get a warning that tells me I can’t move the control node’s position because it’s determined by the parent. I’m not sure how to make this function with the buttons I already have placed and local to my UI scene. I tried reparenting them to new control nodes, but the position gets wonky there too. What would you recommend?
Example 1 w/ Template Button :


Example 2 w/ Local Buttons :

Try using a TextureRect instead of a Sprite2D for each PVW; maybe a TextureButton. I believe you want a GridContainer instead of a VBoxContainer too.

After playing around with it, I’m not sure what to do now…Is there any type of container that I can freely move the units around in? I was hoping to keep the look it currently had, but all the containers I’ve tried don’t allow for a lot of spacing in between like I’d like but thank you anyways! May just have to find another way around this…I wish I could do something that had a good even mix of all of the containers.


And for some reason each container moves all of my buttons around. and won’t let me resize them. Will need to play around some more for sure!

You can set the container’s spacing through theme or theme overrides on the container node. Containers do not let you freely move items around though, they are built to organize items for you.

1 Like

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