MediaPlayer_EditorMute.cs 852 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. //-----------------------------------------------------------------------------
  3. // Copyright 2015-2022 RenderHeads Ltd. All rights reserved.
  4. //-----------------------------------------------------------------------------
  5. namespace RenderHeads.Media.AVProVideo
  6. {
  7. public partial class MediaPlayer : MonoBehaviour
  8. {
  9. #region Audio Mute Support for Unity Editor
  10. #if UNITY_EDITOR
  11. private bool _unityAudioMasterMute = false;
  12. private void CheckEditorAudioMute()
  13. {
  14. // Detect a change
  15. if (UnityEditor.EditorUtility.audioMasterMute != _unityAudioMasterMute)
  16. {
  17. if (_controlInterface != null)
  18. {
  19. _unityAudioMasterMute = UnityEditor.EditorUtility.audioMasterMute;
  20. _controlInterface.MuteAudio(_audioMuted || _unityAudioMasterMute);
  21. }
  22. }
  23. }
  24. #endif
  25. #endregion // Audio Mute Support for Unity Editor
  26. }
  27. }