public async Task Execute(BundleInfo info) { var path = Path.Combine(settings.BasePath, info.Path); if (bundles.Has(info.Id)) { return; } var request = UnityWebRequestAssetBundle.GetAssetBundle(path); //log.Trace("REQUEST " + path); await request.SendWebRequest(); var hasError = request.isHttpError || request.isNetworkError; if (hasError) { log.Warn("no bundle at " + path); return; } var bundle = DownloadHandlerAssetBundle.GetContent(request); bundles.Store(info.Id, bundle); info.Scenes?.Each(name => scenes.Load(name)); }
private async Task InitContexts(IEnumerable <ContextInfo> contextInfos, IContext parentContext) { foreach (var contextInfo in contextInfos) { var scene = await scenes.Load(contextInfo.Id); var roots = scene.GetRootGameObjects(); foreach (var root in roots) { var rootComp = root.GetComponent <IContextInitializer>(); if (rootComp != null) { var childContext = rootComp.InitContext(contextInfo.Id, parentContext); if (contextInfo.Contexts != null) { await InitContexts(contextInfo.Contexts, childContext); } } } } }