public class AudioManager : MonoBehaviour
{
public Sound[] sounds;
- public AudioSource currentSource;
public static AudioManager instance;
void Awake()
public void Play(string name)
{
Sound s = Array.Find(sounds, sound => sound.name == name);
- currentSource = s.source;
- currentSource.Play();
+ s.source.Play();
}
}
\ No newline at end of file