Godot Version
4.7
Question
I wanted to make a button that spawns destroyable buttons when pressed and ran into the issue being that upon being pressed, the spawnable kills both itself and its parent. Help!
Also, I accidentally made a pending post with the wrong code, how do I delete it?
extends Button
func _ready():
self.pressed.connect(_button_pressed)
func _button_pressed():
## print("Until we meet again world!")s
## get_tree().change_scene_to_file("res://menu.tscn")
var button = Button.new()
button.text = "KILL me"
add_child(button)
button.pressed.connect(_button_destroy)
func _button_destroy():
self.queue_free()