void ProcessFinishedOperation(AssetBundleOperation operation) { AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation; if (download == null) { return; } if (string.IsNullOrEmpty(download.error)) { mLoadedAssetBundles.Add(download.AssetbundleName, download.assetBundleRes); } else { string msg = string.Format("Failed downloading bundle {0} from {1}: {2}", download.AssetbundleName, download.GetSourceURL(), download.error); mDownloadingErrors.Add(download.AssetbundleName, msg); } mDownloadingBundles.Remove(download.AssetbundleName); }
/// <summary> /// 从给定资产包开始一个场景的加载操作。 /// </summary> public static AssetBundleOperation LoadSceneAsync(string _assetbundleName, string _sceneName, bool _isAdditive) { AssetBundleOperation operation = null; if (Application.platform == RuntimePlatform.WindowsEditor) { #if UNITY_EDITOR if (SimulateAssetBundleInEditor) { operation = new AssetBundleSceneSimulationOperation(_assetbundleName, _sceneName, _isAdditive); } #endif } else { LoadAssetBundle(_assetbundleName); operation = new AssetBundleSceneOperation(_assetbundleName, _sceneName, _isAdditive); mProgressOperations.Add(operation); } return(operation); }