- Home /
Global audio option
Hi, I created a mobile game on wich the user can turn on/off music and sound effects separately. My current solution is not a good one, before a sound effect occur, the program checks if sound effects are enabled there must be a better solution, is there a global option for that ?
Thank you !
Answer by SarperS · Oct 13, 2012 at 12:55 AM
There is no global option. Each time you load a scene, you can gather all your sound effects in an array of AudioSource's using FindObjectsOfType method, and set their volume to zero in a foreach loop if the sound effects are off. You can also get the music's AudioSource separately and set it's volume accordingly. This way you don't have to check for the option each time you play a sound, they will play all the time but they will be muted.
Your answer
Follow this Question
Related Questions
recording sound from different locations? 0 Answers
What are the advantages of stereo sound effects? 0 Answers
Audio Play Time Inconsistent 0 Answers
Sound plays right at the beginning 2 Answers
Speed of sound delay adjustment 1 Answer