Topic was automatically imported from the old Question2Answer platform.
Asked By
voylin
Hey guy’s, I’ve been struggling a bit with getting a for loop going to get all child nodes which are buttons into a list. I can’t figure out how to catch all child objects of a node, this is my code:
func on_option_buttonPressed(value):
for x in $ChooseGame/CC/PanelContainer/ChooseGameOptions:
print(x.name)
You can get a node’s children using Node.get_children():
This returns an array, which you can loop through:
for x in $SomeNode.get_children():
print(x.name)
Thank you so much, I was thinking about this the whole day already and now that I know the answer it sounds so logical ^^" I kind of feel a bit dumb right now for not thinking about that earlier.