I'm trying to create a CustomButtonGroup resource type to work togheter with a CustomButton.
I want to get all nodes that is referencing a specific instance of this CustomButtonGroup and execute some code with that.
In my custom resource
var group_name: String
func _init(new_name: String) -> void:
group_name = new_name
func get_all_buttons() -> Array:
#Here I want to get all nodes that are referencing to this instance
return [button1, button2, etc]
func execute_custom_button_function() -> void:
for button in get_all_buttons():
And in my button
var custom_button_group: MyButtonGroup
#Execute some code
I know that I can put some
setget on the
var custom_button_group inside my button and every time I change it, I append this button inside an array in the button_group, but I don't wanna to do that because I'll use this for others custom buttons too and to other situation so I might I can do this dynamically from the resource side.
I tried to read the ResourceLoader documentation but I couldn't make it work. I didn't find some question about it too.