using System; using System.Threading.Tasks; using UnityEngine; namespace ETModel { public static class BundleHelper { public static async Task DownloadBundle() { Game.EventSystem.Run(EventIdType.LoadingBegin); await StartDownLoadResources(); Game.EventSystem.Run(EventIdType.LoadingFinish); } public static async Task StartDownLoadResources() { if (Define.IsAsync) { try { using (BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.AddComponent()) { await bundleDownloaderComponent.StartAsync(); } Game.Scene.GetComponent().LoadOneBundle("StreamingAssets"); ResourcesComponent.AssetBundleManifestObject = (AssetBundleManifest)Game.Scene.GetComponent().GetAsset("StreamingAssets", "AssetBundleManifest"); } catch (Exception e) { Log.Error(e); } } } } }