private void InitAssetBundleInfo()
        {
            AssetBundleInfo abInfo = null;

            if (loadMulti)
            {
                abInfo = new EditorMultiAssetBundleInfo();
            }
            else
            {
                abInfo = new EditorSingleAssetBundleInfo();
            }

            this.state                 = EBundleLoadState.EState_Complete;
            this.bundleInfo            = CreateBundleInfo(abInfo);
            this.bundleInfo.IsReady    = true;
            this.bundleInfo.onUnloaded = OnBundleUnload;
        }
        public void UnLoadUnusedAssetBundle(bool bForce)
        {
            if (!isLoading || bForce)
            {
                List <string> bundleNames = ListPool <string> .Get();

                bundleNames.AddRange(loadedAssetBundles.Keys);

                int  unloadMax       = 20;
                int  unloadedCount   = 0;
                bool hasUnusedBundle = false;

                for (int index = bundleNames.Count - 1; index >= 0 && unloadedCount < unloadMax; --index)
                {
                    string          bundleName = bundleNames[index];
                    AssetBundleInfo bundleInfo = loadedAssetBundles[bundleName];

                    if (null == bundleInfo)
                    {
                        Logger.LogError("the bundle is null " + bundleName);
                    }

                    if (bundleInfo.IsUnused)
                    {
                        RemoveAssetBundle(bundleInfo);
                        ++unloadedCount;
                        hasUnusedBundle = true;
                    }
                }

                ListPool <string> .Release(bundleNames);

#if UNITY_EDITOR
                if (hasUnusedBundle)
                {
                    Resources.UnloadUnusedAssets();
                }
#endif
            }
        }
 public void RemoveAssetBundle(AssetBundleInfo abInfo)
 {
     abInfo.Dispose();
     loadedAssetBundles.Remove(abInfo.bundleName);
     loaderCacheDic.Remove(abInfo.bundleName);
 }
 private void OnBundleUnLoad(AssetBundleInfo abInfo)
 {
     bundleInfo = null;
     this.state = EBundleLoadState.EState_None;
 }
 private void OnDepLoadCompleted(AssetBundleInfo abInfo)
 {
     --currentLoadingDepCount;
     CheckDepLoadCompleted();
 }