void LoadDependencies() { string[] dependencies = info.dependencies; m_WaitDependencyLoadCount = dependencies.Length; m_WaitDependencyCompleteCount = dependencies.Length; #if ASSETMANAGER_LOG Debug.Log("Load Dependencies " + dependencies.Length + "," + Time.frameCount); #endif m_DependencyLoaders = ListPool <AssetBundleAsyncLoader> .Get(); m_DependenciesIsLoaded = false; m_DependenciesIsDone = false; for (int i = 0, l = dependencies.Length; i < l; ++i) { string dep = dependencies[i]; if (dep.Contains("blue_s")) { assetManager.StartCoroutine(testLoader(dep)); continue; } AssetBundleAsyncLoader depLoader = assetManager.LoadAssetBundle(dep, false, OnDependencyComplete) as AssetBundleAsyncLoader; if (depLoader != null) { depLoader.autoRelease = false; depLoader.onAssetBundleLoaded += OnDependencyLoaded; } m_DependencyLoaders.Add(depLoader); } }
protected void OnDependencyLoaded(AssetBundleAsyncLoader loader) { #if ASSETMANAGER_LOG Debug.Log("DependencyLoaded " + info.fullName + "->" + loader.info.fullName + "," + Time.frameCount); #endif if (--m_WaitDependencyLoadCount == 0) { m_DependenciesIsLoaded = true; } }
IEnumerator testLoader(string dep) { yield return(new WaitForSeconds(0.5f)); AssetBundleAsyncLoader depLoader = assetManager.LoadAssetBundle(dep, false, OnDependencyComplete) as AssetBundleAsyncLoader; if (depLoader != null) { depLoader.autoRelease = false; depLoader.onAssetBundleLoaded += OnDependencyLoaded; } m_DependencyLoaders.Add(depLoader); }