/// <summary> /// Instantiates the asset and returns it. /// </summary> /// <returns> /// The asset. /// </returns> public GameObject InstantiateAsset() { if (isDone) { GameObject newAsset = Instantiate(loadedAsset) as GameObject; assetManager.AddBundle(bundleName, thisAssetBundle, newAsset); return(newAsset); } else { Debug.LogError("Asset is not downloaded!"); return(null); } }
public IEnumerator Execute() { if (AssetBundleManager.TryToGetBundle(bundleName, out assetBundle)) { isDone = true; yield break; } var loadOperation = AssetBundle.LoadFromFileAsync(Path.Combine(AssetBundleManager.assetBundlesPath, bundleName)); yield return(loadOperation); assetBundle = loadOperation.assetBundle; AssetBundleManager.AddBundle(bundleName, assetBundle); isDone = true; }