0 votes

I'm trying to making a CustomButtonGroup resource type and I want to be able to get all nodes that are referencing a specific instance of this resource.
The scenario I'm trying to do is:

In my CustomButtonGroup I have

extends Resource
class_name CustomButtonGroup

var group_name: String

func get_all_buttons():
    #Here I want to be able to retrieve the buttons that references this instance
    var buttons_array = get_referencing() or get_dependents() or...
    return buttons_array

func execute_custom_function():
    for button in get_all_buttons():
        if not button is CustonButton: return

And this is my CustomButton:

extends Button
class_name CustomButton

var custom_button_group: CustomButtonGroup

func custon_function():
    #Execute some code

I know that I can define the var custom_button_group as setget and every time it's changed, I append self inside an array in CustomButtonGroup, but I don't want to do this way because I will use various types of buttons I don't want to create the setget on all then. Futhermore, I want to performe this operations in other situations too.
I was looking about ResourceLoader and ResourceFormatLoader but I cannot understand the documentation (because I'm new to godot yet - 1mo)

Godot version v3.3.3
in Engine by (20 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.