private static IEnumerator LoadMusic(bool force = false) { if (Config.IncludeOST) { LoadOST(); } LoadCustomMusic(); var failed = failedPaths.Count(); yield return(new WaitWhile(() => WaitScreen.main == null)); if (OSTPreload == null && OST.Any(x => x.Value == null)) { OSTPreload = CoroutineHost.StartCoroutine(PreloadOST()); } if (CustomMusicPreload == null && CustomMusic.Any(x => x.Value == null)) { CustomMusicPreload = CoroutineHost.StartCoroutine(PreloadCustomMusic()); } if ((OSTPreload != null || CustomMusicPreload != null) && force) { FreezeTime.Begin("CustomTunesPreload"); WaitScreen.ShowImmediately(); } yield return(OSTPreload); yield return(CustomMusicPreload); GeneratePlaylist(); yield return(new WaitWhile(() => WaitScreen.main.isShown)); FreezeTime.End("CustomTunesPreload"); if (failedPaths.Count() > failed) { ErrorMessage.AddError("Some tracks failed to load, see error log for details."); } }