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 areVolumeSave.soundSave.master,.soundand.music. The options menu shows them with the format"F0" + " dB".SfxVolumebelongs to the mixer parametersSoundandOtherSounds.)
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
0when 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 return0whileVolumeSave.instanceisnull.)