Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

You just need a slider going from -24 to 0 value wise (you can use a different range, I like that one which was used in the tutorial I followed). Then you connect the value_changed signal to a script running this code:

func _on_VolumeSlider_value_changed(value):
    if value == -24:
        AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true)
    else:
        AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), false)
        AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), value)

You need to tweak the buses if you want to use different ones for music and sound effects. This will affect the master volume. Enjoy!