assetBundleName | AssetBundle 名称。 |
bool 当缓存清除成功时返回 true。
从缓存中删除给定 AssetBundle 的所有缓存版本。
如果有任何缓存的包正在使用,则返回 false。
using System.Collections; using UnityEngine.Networking; using UnityEngine;
public class Example : MonoBehaviour { IEnumerator ClearAllCachedVersionsExample(string uri) { //Download the bundle UnityWebRequest request = UnityWebRequestAssetBundle.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);
//Unload the AssetBundle bundle.Unload(true); } }