/// <param name="remoteManifestName"> /// Filename for the remote manifest, so this decorator knows it should be ignored. /// </param> /// <param name="platformName">Name of the platform to use</param> /// <param name="decorated">CommandHandler to use when the bundle is not available in StreamingAssets</param> /// <param name="strategy"> /// Strategy to use. Defaults to having remote bundle override StreamingAssets bundle if the hashes /// are different /// </param> public StreamingAssetsBundleDownloadDecorator(string remoteManifestName, string platformName, ICommandHandler <AssetBundleDownloadCommand> decorated, AssetBundleManager.PrioritizationStrategy strategy) { this.decorated = decorated; this.remoteManifestName = remoteManifestName; currentStrategy = strategy; currentPlatform = platformName; #if UNITY_EDITOR if (!Application.isPlaying) { coroutineHandler = EditorCoroutine.Start; } else #endif coroutineHandler = AssetBundleDownloaderMonobehaviour.Instance.HandleCoroutine; fullBundlePath = Application.streamingAssetsPath + "/" + currentPlatform; var fullManifestPath = fullBundlePath + "/" + currentPlatform; var manifestBundle = AssetBundle.LoadFromFile(fullManifestPath); if (manifestBundle == null) { Debug.LogWarningFormat("Unable to retrieve manifest file [{0}] from StreamingAssets, disabling StreamingAssetsBundleDownloadDecorator.", fullManifestPath); } else { manifest = manifestBundle.LoadAsset <AssetBundleManifest>("assetbundlemanifest"); manifestBundle.Unload(false); } }
/// <param name="decorated">CommandHandler to use when the bundle is not available in StreamingAssets</param> /// <param name="strategy"> /// Strategy to use. Defaults to having remote bundle override StreamingAssets bundle if the hashes /// are different /// </param> public StreamingAssetsBundleDownloadDecorator(ICommandHandler <AssetBundleDownloadCommand> decorated, AssetBundleManager.PrioritizationStrategy strategy) { this.decorated = decorated; currentStrategy = strategy; currentPlatform = Utility.GetPlatformName(); #if UNITY_EDITOR if (!Application.isPlaying) { coroutineHandler = EditorCoroutine.Start; } else #endif coroutineHandler = AssetBundleDownloaderMonobehaviour.Instance.HandleCoroutine; fullBundlePath = string.Format("{0}/{1}", Application.streamingAssetsPath, Utility.GetPlatformName()); Debug.Log("Download Bundle from : " + fullBundlePath + "\n StreamingAssetsBundleDownloadDecorator()"); var manifestBundle = AssetBundle.LoadFromFile(string.Format("{0}/{1}", fullBundlePath, currentPlatform)); if (manifestBundle == null) { Debug.LogWarning("Unable to retrieve manifest file from StreamingAssets, disabling StreamingAssetsBundleDownloadDecorator."); } else { manifest = manifestBundle.LoadAsset <AssetBundleManifest>("assetbundlemanifest"); manifestBundle.Unload(false); } }
/// <param name="decorated">CommandHandler to use when the bundle is not available in StreamingAssets</param> /// <param name="strategy"> /// Strategy to use. Defaults to having remote bundle override StreamingAssets bundle if the hashes /// are different /// </param> public StreamingAssetsBundleDownloadDecorator(ICommandHandler <AssetBundleDownloadCommand> decorated, AssetBundleManager.PrioritizationStrategy strategy) { this.decorated = decorated; this.currentStrategy = strategy; fullBundlePath = string.Format("{0}/{1}", Application.streamingAssetsPath, Utility.GetPlatformName()); var manifestBundle = AssetBundle.LoadFromFile(string.Format("{0}/{1}", fullBundlePath, Utility.GetPlatformName())); if (manifestBundle == null) { Debug.LogWarning("Unable to retrieve manifest file from StreamingAssets, disabling StreamingAssetsBundleDownloadDecorator."); } else { manifest = manifestBundle.LoadAsset <AssetBundleManifest>("assetbundlemanifest"); manifestBundle.Unload(false); } }