AUDIO MANAGER
The best solution in my opinion would be to have an AudioManager in your scene. You can give it an AudioSource and and some sort of 'AudioManager' script.
The script can just contain a List of sound effects or something, and you can play each one using the AudioSource.PlayOneShot(audioClip) function. If you want a reference to make it easy to understand, heres my AudioManager that I use:
using UnityEngine;
public class AudioManager : MonoBehaviour
{
// Reference to the AudioSource on the object.
private AudioSource m_Source;
// Reference to a SoundsAsset (a custom data type I made to store sounds for my game)
public SoundsAsset soundsAsset;
// Reference to the Instance of the Singleton -- https://stackoverflow.com/questions/2155688/what-is-a-singleton-in-c
public static AudioManager Instance;
void Awake() {
// Singleton pattern.
if (Instance != null && Instance == this) {
Destroy(gameObject);
}
else Instance = this;
m_Source = GetComponent<AudioSource>();
}
public void PlaySoundEffect(string soundName) {
// If the sound name we entered is empty or null, return.
if (soundName == null || soundName == string.Empty) return;
switch (soundName)
{
// If we typed sound1, play the sound1 sound found in the soundsAsset, you can replace this with an audioclip and sound name of your choice.
case "sound1":
m_Source.PlayOneShot(soundsAsset.sound1);
break;
case "sound2":
m_Source.PlayOneShot(soundsAsset.sound2);
break;
}
}
}
This is a simplified version but hopefully it helps you understand, in the button's onClick function, you can select the audiomanager, and call the playsoundeffect() function along with the name of your sound. In this case I use a SoundsAsset to store all the sounds, but you could just use a list of AudioClips too.
MUSIC MANAGER
In my music manager, I create an audiosource for each audioclip put in, this is purely so that multiple music clips can fade and play at the same time. If you dont want that, you can just create a MusicManager, that simply has one audiosource, and create a MusicManager script that changes the music playing. Don't forget to use DontDestroyOnLoad, to make sure the Manager isn't destroyed when loading a new scene.
Hope this helps.