/// <summary> /// 卸载bundle /// </summary> /// <param name="bundle">要卸载的bundle</param> internal void UnLoad(ABundle bundle) { if (bundle == null) { throw new ArgumentException($"{nameof(BundleManager)}.{nameof(UnLoad)}() bundle is null."); } //引用-1 bundle.ReduceReference(); //引用为0,直接释放 if (bundle.reference == 0) { if (!bundle.done && bundle is BundleAsync) { BundleAsync bundleAsync = bundle as BundleAsync; if (m_AsyncList.Contains(bundleAsync)) { m_AsyncList.Remove(bundleAsync); } } m_BundleDic.Remove(bundle.url); bundle.UnLoad(); } }
/// <summary> /// 卸载bundle /// </summary> /// <param name="bundle">要卸载的bundle</param> internal void UnLoad(ABundle bundle) { if (bundle == null) { throw new ArgumentException($"{nameof(BundleManager)}.{nameof(UnLoad)}() bundle is null."); } //引用-1 bundle.ReduceReference(); //引用为0,直接释放 if (bundle.reference == 0) { WillUnload(bundle); } }
/// <summary> /// 卸载bundle /// </summary> /// <param name="bundle">要卸载的bundle</param> internal void UnLoad(ABundle bundle) { if (bundle == null) { throw new ArgumentException($"{nameof(BundleManager)}.{nameof(UnLoad)}() bundle is null."); } //引用-1 bundle.ReduceReference(); //引用为0,直接释放 if (bundle.reference == 0) { //严格遵循要加载完了才能释放 if (!bundle.done) { return; } m_BundleDic.Remove(bundle.url); bundle.UnLoad(); } }