namespace UnityEngine.AzureSky { [RequireComponent(typeof(AudioSource))] [AddComponentMenu("Azure[Sky] Dynamic Skybox/Azure Sound FX")] public sealed class AzureSoundFX : MonoBehaviour { /// The audio source attached to this game object. private AudioSource m_audioSource; /// The volume of the audio source attached to this game object. public float volume { get => m_volume; set { m_volume = value; if (m_audioSource) { m_audioSource.volume = value; if (value > 0) { if (!m_audioSource.isPlaying) m_audioSource.Play(); } else if (m_audioSource.isPlaying) m_audioSource.Stop(); } } } [SerializeField] private float m_volume; private void Awake() { m_audioSource = GetComponent(); } } }