Hey there!

Just starting the fall in love for this community!

Can someone help me to do this in a better way?

I m setting different Icons and Labels in Buttons:

get_node(Path/Button1).icon = load(Png) get_node(Path/Button1).text = "SomethingDifrentAllTime" ................................Button2 . . . I would like to create a group & for button in get_tree().get_nodes_in_group() Create a kind of array with the icon and label associated in the order of for. Is that possible?

Thank you for all!

Welcome to the forums @AlPhAmAiN10!

It should be possible to use a group for this. You'll just need to add all the buttons to a group. Something like this should work, I think:

export (array, String) var button_labels
export (array, Image) var button_icons

func _ready():
	var nodes_in_group = get_tree().get_nodes_in_group("buttons")
	for i in range(0, nodes_in_group.size()):
		var group_node = nodes_in_group[i]
		if (group_node is Button):
			if (i < button_labels.size()):
				group_node.text = button_labels[i]
			if (i < button_icons.size()):
				group_node.icon = button_icons[i]

Then it should just be a matter of assigning the buttons to the groups and assigning the exported variables in the Godot editor, assuming I wrote the code correctly :smile: