Version: 2020.1

Caching.ClearAllCachedVersions

切换到手册
public static bool ClearAllCachedVersions (string assetBundleName);

参数

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 = 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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961