Godot Version
4.2
Question
` Hi guys, I was wondering, when an instantiated node is freed, what happens to the signals connected to its parent? Are they all disconnected automatically, or do I need to disconnect them before freeing the node
This is the code where I am free and connecting the signals
func _set_heroes_grid() -> void:
# get the current heroes in the grid by his index
var grid_sizing = 4;
var new_heroes = heroes_pool.slice(index * grid_sizing, grid_sizing + (index * grid_sizing))
var grid = $GridChampions
# check if exist heroes on the stack and clean
var current_heroes = grid.get_child_count()
if current_heroes > 0:
var children = grid.get_children()
for hero in children:
hero.free()
# create and instance the heroes
for hero in new_heroes:
var instance = _hero_avatar.instantiate() as HeroAvatar
instance.hero_data = hero
grid.add_child(instance)
instance.connect('pressed', _open_character_details)
`