/// <summary> /// 読み込み済み全体アセットの取得 /// </summary> /// <param name="assetBundleName">アセットバンドル名</param> public T[] GetLoadedAllAssets <T>(string assetBundleName) where T : UnityEngine.Object { AllAssetsOperation <T> assetOperation = null; if (this.CheckAssetLoaded <AllAssetsOperation <T> >(assetBundleName, null, out assetOperation)) { return(assetOperation.GetAllAssets()); } else { return(null); } }
/// <summary> /// 全アセット読み込み /// </summary> /// <param name="assetBundleName">アセットバンドル名</param> /// <param name="onLoad">読み込み完了時コールバック</param> public void LoadAllAssets <T>(string assetBundleName, Action <T[]> onLoad = null) where T : UnityEngine.Object { if (!this.CheckAssetBundleExists(assetBundleName)) { onLoad.SafetyInvoke(null); return; } var data = this.resourceList[assetBundleName]; var assetOperation = data.FindAssetOperation <AllAssetsOperation <T> >(); //初めての読み込み if (assetOperation == null) { //アセット管理データ作成 assetOperation = new AllAssetsOperation <T>(onLoad); data.AddAssetOperation(assetOperation); //読み込み開始 this.UpdateAssetBundleOperation(data); } //ロード済み else if (assetOperation.GetStatus() == AssetOperationBase.Status.isLoaded) { //1フレーム後にコールバック実行 StartCoroutine(CoroutineUtility.WaitForFrameAction(1, () => { onLoad.SafetyInvoke(assetOperation.GetAllAssets()); })); } //ロード中 else { //コールバック追加 assetOperation.AddCallBack(onLoad); } }