Caching.ClearCachedVersion

切换到手册
public static bool ClearCachedVersion (string assetBundleName, Hash128 hash);

参数

assetBundleNameAssetBundle 名称。
hash需要清除的版本。

返回

bool 缓存清除成功时,返回 true。如果有任何缓存的 AssetBundle 处于使用状态,则返回 false。

描述

删除 AssetBundle 的给定版本。

using UnityEngine;

public class Example : MonoBehaviour { void ClearAssetBundleBundleFromCache(AssetBundle bundleToClear, string manifestBundlePath) { AssetBundle manifestBundle = AssetBundle.LoadFromFile(manifestBundlePath); AssetBundleManifest manifest = manifestBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");

//This will clear the cached version from all caches, not just the currentCacheForWriting Caching.ClearCachedVersion(bundleToClear.name, manifest.GetAssetBundleHash(bundleToClear.name)); } }