Godot Version
4.2.2(stable)
Question
func offer_calls(calls_to_offer,player):
var parent = get_node("HBoxContainer/"+str(player))
var label = Label.new()
label.text = player
parent.add_child(label)
for call1 in calls_to_offer:
var button = Button.new()
button.text = call1
parent.add_child(button)
button.pressed.connect(self.call_button_pressed.bind(button))
func clear_call_buttons():
for player in $"../Backend".get_node("RoundData").player_list:
var parent = get_node("HBoxContainer/"+str(player))
var children = parent.get_children()
for child in children:
if child == Label:
continue
child.queue_free()
This code is functional. Using existing parents in the scene, a label and number of buttons will be instantiated as children of 1 parent. Then after a button is pressed, the clear_call_button() func is called, freeing these buttons.
The process works as intended, instantiating and clearing the buttons, and then suddenly it will reach a point where the buttons should be instantiated, but they simply are not.
No error is thrown, no crash occurs, it just works until it doesn’t.
Any thoughts? Thank you for any help you may have.