Godot Version
4.3
Question
Hello, I have a following container structure in my Card Draft game.
I am trying to add a different scene as a child to the TopCardsContainer. Here is the code for the better understanding. The other scene is a simple Panel, that has VBox with 2 Label nodes inside of it.
# Load 4 random cards
for i in range(4):
var random_card_data = get_random_card_data()
var card_instance = preload("res://Card.tscn").instantiate()
print("i ", top_cards_container.size)
card_instance.set_card_data(random_card_data)
# Connect the card's custom signal to handle selection
card_instance.connect("card_selected_signal", Callable(self, "_on_card_selected"))
top_cards_container.add_child(card_instance)
Setting the data works, but adding children stacks them on top of each other.
I checked, there are 4 children inside this top_cards_container. Is there something I am missing here? How can I make them separated, since they are being added inside the HBoxContainer which should actually do that.
MainVBox is full rect and here is the Inspector for the Card scene where I have Panel as a root node.