public static string GetBundlePath(string bundleName) { string bundlePath = Path.Combine(PlatformUtility.GetExternalPath(), bundleName); if (File.Exists(bundlePath)) { return(bundlePath); } return(Path.Combine(PlatformUtility.GetStreamingAssetsPath(), bundleName)); }
public static void CheckInstallationPackage(string versionPath) { updateTaskType = TaskType.CheckInstallationPackage; string bundleName; if (!AssetBundleManager.Instance.GetBundleName(versionPath, out bundleName)) { return; } string bundlePath = Path.Combine(PlatformUtility.GetExternalPath(), bundleName); if (!File.Exists(bundlePath)) { return; } AssetBundleManager.Instance.UnloadAssetBundle(bundleName); bundlePath = Path.Combine(PlatformUtility.GetStreamingAssetsPath(), bundleName); AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath); if (bundle == null) { return; } string assetName = Path.GetFileNameWithoutExtension(versionPath); VersionUpdateData packageVersionData = bundle.LoadAsset <VersionUpdateData>(assetName); bundle.Unload(false); if (packageVersionData == null || versionData.versionNumber >= packageVersionData.versionNumber) { return; } Debug.LogFormat("The external path version is {0}, package version is {1}, Delete the external path.", versionData.versionNumber, packageVersionData.versionNumber); AssetBundleManager.Instance.UnloadAllAssetBundle(); Directory.Delete(PlatformUtility.GetExternalPath(), true); AssetBundleManager.Instance.LoadedManifestAssetBundle(); }
public static System.Collections.IEnumerator CheckUpdate(MonoBehaviour monoBehaviour) { using (downloadTask = new DownloadUpdateTask(monoBehaviour, versionData.versionUrl, versionData.versionNumber, Application.temporaryCachePath, PlatformUtility.GetExternalPath())) { yield return(downloadTask); error = downloadTask.error; if (downloadTask.updateVersionCount > 0 && string.IsNullOrEmpty(downloadTask.error)) { AssetBundleManager.Instance.UnloadAllAssetBundle(); AssetBundleManager.Instance.LoadedManifestAssetBundle(); } } }