Godot Version
4.4
Question
I want to display nodes that are separated by equal margin (horizontally) depending on the count of the nodes… something like hbox container but its node version. Nodes will be added programmatically
4.4
I want to display nodes that are separated by equal margin (horizontally) depending on the count of the nodes… something like hbox container but its node version. Nodes will be added programmatically
You need to code the placement the nodes yourself since Hboxcontainer only works on control nodes.
Nodes do not have a visual representation in game.
you need a Node2D or Node3D inherited node, or controls.
there is nothing wrong with using Controls as game objects.
it would help to know more about what you are trying to do.
if this is for cards, in my case I used Controls since they play better with dragging, but I set their position automatically by doing the calculations and moving them with Tweens. So they were children of a Control node.
for 2D and 3D it’s the same, but you need to know the space that will be used beforehand.
take the space, dividie it by the number of elements, then add (or move) the elements one by one while adding the separation to a final value and placing the last item there.