public void StopMusicTest() { #if UNITY_EDITOR UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1); #endif ResMgr.Init(); var loader = ResLoader.Allocate(); // 提前预加载,否则会进行异步加载 loader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsMusicOn.Value = true; AudioKit.PlayMusic("sound1"); Assert.IsTrue(AudioKit.MusicPlayer.AudioSource.isPlaying); Assert.IsTrue(AudioKit.MusicPlayer.AudioSource.clip); AudioKit.StopMusic(); Assert.IsFalse(AudioKit.MusicPlayer.AudioSource.isPlaying); Assert.IsFalse(AudioKit.MusicPlayer.AudioSource.clip); loader.Recycle2Cache(); loader = null; }