private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
AudioSource stingSource; //Reference to the generated sting Audio Source void Awake() { //If an AudioManager exists and it is not this... if (current != null && current != this) { //...destroy this. There can be only one AudioManager Destroy(gameObject); return; } //This is the current AudioManager and it should persist between scene loads current = this; DontDestroyOnLoad(gameObject); //Generate the Audio Source "channels" for our game's audio stingSource = gameObject.AddComponent <AudioSource>() as AudioSource; //Assign each audio source to its respective mixer group so that it is //routed and controlled by the audio mixer stingSource.outputAudioMixerGroup = stingGroup; }
public void playClick() { AudioManagerMenu.playButtonClick(); }
public void playHover() { AudioManagerMenu.playButtonHover(); }