public IEnumerator LoadAllAssetsAsync(string assetBundleName, int version, OnAllAssetsLoaded Loaded) { if (m_AssetBundleManifest == null) { UnityEngine.Debug.LogError(string.Format("LoadAllAssetsAsync failed, Please initialize AssetBundleManifest first. asset={0}, ver={1}", assetBundleName, version)); yield break; } // Load all assets from assetBundle. AssetBundleLoadAllAssetsOperation request = LoadAllAssetsAsync(assetBundleName, version); if (request == null) { yield break; } yield return(StartCoroutine(request)); if (Loaded != null) { // Get the asset. Object[] objs = request.GetAllAssets(); string[] assetNames = request.GetAllAssetNames(); Loaded(objs, assetNames, assetBundleName); } }
// Load all assets from the given assetBundle. private AssetBundleLoadAllAssetsOperation LoadAllAssetsAsync(string assetBundleName, int version) { AssetBundleLoadAllAssetsOperation operation = null; LoadAssetBundle(assetBundleName, version, ThreadPriority.High); operation = new AssetBundleLoadAllAssetsOperation(assetBundleName); m_InProgressOperations.Add(operation); return(operation); }