/// <summary> /// Plays a BGM /// </summary> /// <param name="bgm"></param> public void Play(BGMData bgm) { _currentBGM = bgm; _musicSource.Stop(); _musicSource.clip = bgm.BGM.Load(); _musicSource.Play(); }
/// <summary> Plays a BGM </summary> /// <param name="bgm"> </param> public void Play(BGMData bgm) { bgm.BGM.LoadAsync() .Then(clip => { if (_currentBGM != null && _currentBGM.BGM.IsLoaded) { _currentBGM.BGM.Unload(); } _musicSource.Stop(); _musicSource.clip = clip; _musicSource.Play(); _currentBGM = bgm; }) .Done(); }