0 votes

I am making a menu system where I change visibility of various sub-menus with button presses via the VS.

I have noticed that I can have multiple buttons give the same signal to the VS (I duplicated my "Return to Main Menu" button and it also duplicated the signal link with full functionality).

I want every signal call to result in setting visibility of the parent (container) of pressed button to false.
This way I dont need to copy the script for each sub-menu return button call.
It currently looks like this:
enter image description here

As you can see, I can't find a proper way to link the signaller obj to the Button.get_parent() function.

How can I get the node object from the signalling node?
I need the object to be a universal link just like the function call is universal to all duplicated return buttons.

Godot version v3.3.3.stable.mono.official.b973f997f
in Engine by (15 points)

1 Answer

+1 vote
Best answer

I think the best way to do this is:
- have this script attached to the buttons themselves, and then have a variable that is a reference to the menu that you wish to hide.

To achieve what you're asking:
- have a separate script in each button that then calls this script when clicked and passes "self" as a parameter.

by (1,290 points)
selected by

I went with the suggested solution, thanks!
If you have some time, please explain how to pass "self" as parameter through the VS, I couldn't figure that out.

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 webmaster@godotengine.org with your username.