Volumes

The player sets the master, sound and music volume in the options menu. These properties read what the player chose.

Sounds the player's saved volumes

Read MasterVolume, SfxVolume and MusicVolume to see the sliders the player saved. They are in decibels.

public static class Sounds
{
    public static float MasterVolume { get; }
    public static float SfxVolume { get; }
    public static float MusicVolume { get; }
}
Property Type What it means
MasterVolume float The master slider, in decibels.
SfxVolume float The sound slider (sound effects), in decibels.
MusicVolume float The music slider, in decibels.

Things to know

  • The numbers are decibels, not a percentage. The options menu shows them as, for example, -10 dB. Zero is the loudest and a more negative number is quieter. They are not a 0 to 1 amount. (The values are VolumeSave.soundSave.master, .sound and .music. The options menu shows them with the format "F0" + " dB". SfxVolume belongs to the mixer parameters Sound and OtherSounds.)

Limits

  • You can only read these three numbers. Only the game’s own options menu changes what the player has saved. To make the game louder or quieter for the current session, use SetMixerVolume (see Changing a volume for this session).
  • You get 0 when the game has not set up its volume settings yet. The numbers only exist once the game has loaded the player’s volume settings. (The properties return 0 while VolumeSave.instance is null.)