/// <summary> /// 从加载完成的AssetBundel 中加载资源 /// </summary> /// <param name="loadRecordInfor"></param> /// <param name="isloadSceneAsset"></param> private void LoadAndRecordAsset(AssetBundleLoaderResultInfor loadRecordInfor, AssetBundleExitState assetBundleState, bool isloadSceneAsset) { if (isloadSceneAsset) { var asset = loadRecordInfor.LoadedAssetBundle; //场景资源返回AssetBundle 使用不同的API加载 foreach (var item in loadRecordInfor.m_AllNeedLoadAssetRecord) { if (loadRecordInfor.CheckIfLoadAsset(item)) { continue; } AssetLoaderResultInfor.RecordLoadAsset(item, asset); } } else { if (assetBundleState == AssetBundleExitState.FolderPrefab) { if (AssetBundleMgr.Instance.CheckIfNeedRecord(m_ResourcesUrl)) { var content = loadRecordInfor.LoadedAssetBundle.GetAllAssetNames(); AssetBundleMgr.Instance.RecordFolderAssetBundleContainAsset(m_ResourcesUrl, content); } } //记录 foreach (var item in loadRecordInfor.m_AllNeedLoadAssetRecord) { object asset = null; if (assetBundleState == AssetBundleExitState.FolderPrefab) { if (loadRecordInfor.CheckIfLoadAsset(item)) { continue; } if (AssetBundleMgr.Instance.CheckIfContainAsset(m_ResourcesUrl, item)) { asset = loadRecordInfor.LoadedAssetBundle.LoadAsset(item); // } } else { asset = loadRecordInfor.LoadedAssetBundle.LoadAsset(item); // } AssetLoaderResultInfor.RecordLoadAsset(item, asset); } }//非场景资源需要加载出来 }
public override void InitialLoader() { base.InitialLoader(); AssetLoaderResultInfor = new AssetBundleLoaderResultInfor(); }