Search code examples
iosswiftaudiosprite-kitmute

Swift SpriteKit - mute all scenes audio


I have created an app which has various different audio on each scene, I was wondering how I would go about having an option to mute all sound if the user wanted to (on the main menu page). I know how to create a button and how to click etc. However the actual method in which all scenes are muted is what I need help with.


Solution

  • Create a BOOL that stores this setting, and can be accessed from anywhere in the app. (AppDelegate or NSUserDefaults)

    Then do a check on it every time your app wants to play sounds.

    You can have one for both music and FX.