Hello. I have a group of buttons:
When they are clicked, I want the corresponding UI layer appear on the window. But I don’t want to assign a signal process function for each of the button, I want to deal with all the pressed signal in a single function. If I can get the button object which I pressed, then I can get its name and determine which UI layer should I show. However, the pressed signal does not return any object to the signal process function.
I expected there maybe some properties or methods, such as is_pressed() for button object, so that I can loop through the button list and check which button is pressed. However, there is no such method.
I have a different approach to all that since I put my pop up panels in the same scene in which where the buttons are ( or create a separate scene for the panels then add them as a child to where the buttons that activates them belongs to). So I just use the signals for the button to show() them (they are initially hidden using hide() in _ready() or you can also do that by clicking the ‘eye’ icon in the scene hierarchy). I think this is simpler and faster.
Also, correct me If I am wrong but I am assuming that you put the buttons inside and array to see which one is pressed? I think this is complicating things.
Hope this helps, and if I misunderstood anything, just tell me!