diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs
index 0366cef8f..6561083f9 100644
--- a/Source/Editor/Windows/GameWindow.cs
+++ b/Source/Editor/Windows/GameWindow.cs
@@ -23,6 +23,8 @@ namespace FlaxEditor.Windows
private readonly GameRoot _guiRoot;
private bool _showGUI = true;
private bool _showDebugDraw = false;
+ private bool _audioMuted = false;
+ private float _audioVolume = 1;
private bool _isMaximized = false, _isUnlockingMouse = false;
private bool _isFloating = false, _isBorderless = false;
private bool _cursorVisible = true;
@@ -91,6 +93,35 @@ namespace FlaxEditor.Windows
set => _showDebugDraw = value;
}
+
+ ///
+ /// Gets or set a value indicating whether Audio is muted.
+ ///
+ public bool AudioMuted
+ {
+ get => _audioMuted;
+ set
+ {
+ Audio.MasterVolume = value ? 0 : AudioVolume;
+ _audioMuted = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value that set the audio volume.
+ ///
+ public float AudioVolume
+ {
+ get => _audioVolume;
+ set
+ {
+ if (!AudioMuted)
+ Audio.MasterVolume = value;
+
+ _audioVolume = value;
+ }
+ }
+
///
/// Gets or sets a value indicating whether the game window is maximized (only in play mode).
///
@@ -646,6 +677,24 @@ namespace FlaxEditor.Windows
checkbox.StateChanged += x => ShowDebugDraw = x.Checked;
}
+ menu.AddSeparator();
+
+ // Mute Audio
+ {
+ var button = menu.AddButton("Mute Audio");
+ button.CloseMenuOnClick = false;
+ var checkbox = new CheckBox(140, 2, AudioMuted) { Parent = button };
+ checkbox.StateChanged += x => AudioMuted = x.Checked;
+ }
+
+ // Audio Volume
+ {
+ var button = menu.AddButton("Audio Volume");
+ button.CloseMenuOnClick = false;
+ var slider = new FloatValueBox(1, 140, 2, 50, 0, 1) { Parent = button };
+ slider.ValueChanged += () => AudioVolume = slider.Value;
+ }
+
menu.MinimumWidth = 200;
menu.AddSeparator();
}