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 !

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.

good idea, thanks