using System; using System.Collections; using System.Collections.Generic; using Cysharp.Threading.Tasks; namespace BITKit.Mod { public partial class ModService { public static Func> LoadAssetAsyncFactory; public static async UniTask LoadAsset(string location) where T : class { if (LoadAssetAsyncFactory is null) { throw new Exception("LoadAssetAsyncFactory is null!Make sure Processor has been initialized."); } foreach (var func in LoadAssetAsyncFactory.CastAsFunc()) { var value = await func.Invoke(location); if (value is T value1) { return value1; } } throw new Exception($"Asset not found: {location}"); } } }