// Update is called once per frame void Update() { if (!alreadyPlaying && !musicStarted) { if (music.musicMuted) { music.GetComponent <AudioSource>().clip = Clip; music.GetComponent <AudioSource>().volume = Volume; music.GetComponent <AudioSource>().Play(); musicStarted = true; Debug.Log("UnMutingMusic"); music.musicMuted = false; } } }
void Start() { music = FindObjectOfType <musicManager>(); if (music.GetComponent <AudioSource>().clip != Clip) { music.FadeOutAS(); } else { alreadyPlaying = true; } }
public void PlayMusic(AudioClip audioClip) { MusicManager.GetComponent <AudioSource>().PlayOneShot(audioClip); }