+1 vote

I'm adding audio to my game and what I want to do is have an audio manager with the sfx and audio in it, and each audio player has it's own script that will tell it when to play the audio. Is there a way I can do this? Can I put buttons into a group and if any of those buttons are pressed in that group are pressed a specific sound is played. I'm asking this because I would like to avoid having to connect a crap tonne of is pressed signals to one audio player.

Thanks in advance.

Godot version 3.3.4
in Engine by (48 points)

1 Answer

0 votes

Sounds like you want to use signals. https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html

Basically, every time an event that should play audio happens you can emit a signal and use a function to catch it and play the intended audio effect.

by (144 points)

Hi, thanks for getting back to me!
I am aware of signals but I want to avoid connecting each individual signal from each individual button in my game, which there are many of. I could do it through script but I want to see if there is an easier way and possibly a way that would be better for performance. But if not, I guess this is the only way to do it.
Thanks again, I hope to hear from you again soon!

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.