public static void Play(string name) { if (_source.isPlaying) { _source.Stop(); } var audioClip = BackgroundSoundResource.GetInstance().GetAudioClip(name); _source.clip = audioClip; _source.loop = true; _source.Play(); }
public static BackgroundSoundResource GetInstance() => _instance ?? (_instance = new BackgroundSoundResource());