1 using UnityEngine.Audio;
5 public class AudioManager : MonoBehaviour
11 foreach(Sound s in sounds)
13 s.source = gameObject.AddComponent<AudioSource>();
14 s.source.clip = s.clip;
16 s.source.volume = s.volume;
17 s.source.pitch = s.pitch;
26 public void Play(string name)
28 Sound s = Array.Find(sounds, sound => sound.name == name);
32 public void Stop(string name)
34 Sound s = Array.Find(sounds, sound => sound.name == name);