0 votes

How do I make it so every button under my control node automatically plays a sound when hovered over, without connecting every single signal?

I have a control, under that is a Container, then my 4 buttons. I already have a function for instancing new sounds, i just need a way to make a sound play when hovering over them without having to connect signals to every one.

Godot version v4.0.beta11.mono.official [91713ced8]
in Engine by (16 points)

2 Answers

+1 vote

How about you make the button a scene. Then you just add a single script to the button scene and you can instance it however many times you need without reconnecting any signals every time.

by (2,017 points)
0 votes

I found a solution to this! I think it's pretty alright.

The Solution

The only problem I may have is, if I want to put anything else under that container, I'll have to change the code a bit to check if a button. For now though, it works great.

by (16 points)
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.