private IEnumerator doAsynLoad() { var bundleLoadRequest = AssetBundle.LoadFromFileAsync(Path.Combine(LYAssetManager.FolderPath, m_assertName)); yield return(bundleLoadRequest); AssetBundle bundle = bundleLoadRequest.assetBundle; if (bundle == null) { Debug.LogError("AssetBundleName file not exist:" + Path.Combine(LYAssetManager.FolderPath, m_assertName)); yield break; } Debug.Log("AssetBundleName loaded:" + Path.Combine(LYAssetManager.FolderPath, m_assertName)); LYAssetCache.SetBundleCache(m_assertName, new LYAssetBundle(bundle, m_assertName)); m_state = State.Loaded; }
private LYAssetBundle doLoadAssetBundle(string assetBundleName) { LYAssetBundle ly_bundle = LYAssetCache.GetBundleCache(assetBundleName); if (ly_bundle != null) { //保留一次 ly_bundle.Retain(); return(ly_bundle); } AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(FolderPath, assetBundleName)); if (bundle == null) { Debug.LogError("AssetBundleName file not exist:" + Path.Combine(FolderPath, assetBundleName)); return(null); } ly_bundle = new LYAssetBundle(bundle, assetBundleName); LYAssetCache.SetBundleCache(assetBundleName, ly_bundle); return(ly_bundle); }