assetBundleName | AssetBundle 名称。 |
bool 缓存清除成功时,返回 true。
从缓存中删除给定 AssetBundle 的所有缓存版本。
如果有任何缓存的 AssetBundle 处于使用状态,则返回 false。
using System.Collections;
using UnityEngine.Networking;
using UnityEngine;
public class Example : MonoBehaviour
{
IEnumerator ClearAllCachedVersionsExample(string uri)
{
//Download the bundle
UnityWebRequest request = UnityWebRequest.GetAssetBundle(uri);
yield return request.SendWebRequest();
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);
//Given the name of an asset bundle, this will clear every cached version across all caches
Caching.ClearAllCachedVersions(bundle.name);
}
}