Caching.IsVersionCached

切换到手册
Obsolete public static bool IsVersionCached (string url, int version);

参数

stringUrl - AssetBundle 的文件名。将自动剔除该字符串中的域和路径信息。
intVersion - 要检查的 AssetBundle 的版本号。不允许使用负值。

返回

bool 如果以前使用 UnityWebRequestAssetBundle.GetAssetBundle() 加载过匹配 urlversion 参数的 AssetBundle,并且该 AssetBundle 当前存储在该缓存中,则返回 true。如果 AssetBundle 不在缓存(不管是已将其从缓存中清除还是从未使用缓存 API 加载过它)中,则返回 false。

描述

检查是否缓存了某个 AssetBundle。

使用默认共享缓存时,会自动在 url 参数前插入 WebPlayer 应用程序捆绑包的 URL;这可防止文件名与其他开发人员的 WebPlayer 应用程序使用的同名 AssetBundle 发生冲突。使用专用缓存的 WebPlayer 应用程序不会遇到这种行为。 该函数可用于启用 AssetBundle 预加载。首先,调用 Caching.IsVersionCached() 查看是否已缓存 AssetBundle 的当前版本。如果未缓存 AssetBundle,则可以在后台预加载它,以便在请求时能够立即将其加载到内存中。

5.4.0 及更高版本不支持 Web 播放器。