- Home /
Need help to add a script to an AudioManager
it is easier to make a new script so that a button plays a sound when you click or add a function to the AudioManager i'm using?
Anything is good, depends on your project. If you will need to do "things" with the Audio$$anonymous$$anager, always ios better to have a script.
Answer by Firas4d · Apr 17, 2018 at 08:44 AM
Hi, The easiest way to play a sound when a button is clicked is to add an audio source component to the button then drag that audio source component to the On Click () event's list on the same button and change No Function to AudioSource.Play, this way it's all done within the inspector. See the image below :
Your answer
![](https://koobas.hobune.stream/wayback/20220612160918im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Wanting audio to pause when entering a trigger zone 1 Answer
Audio while player is moving 0 Answers
AudioMixer bypass effect with script 0 Answers
How to control an AudioSource with an AudioClip? 2 Answers
Button audio get cut when pressing it 2 Answers