- Home /
Question by
swifter14 · Feb 16, 2020 at 08:20 PM ·
assetbundlecaching
Does UnityWebRequestAssetBundle use caching automatically?
I use the following code to download my asset bundle from a server. 1. If I run this code for a second time after a restart for my app, will it redownload the bundle or not because it's in the cache? and how will I know if it's redownloading / not downloading 2. I read about hash and version number- how would you change this code to verify the hash and version number 3. Do I need to keep the manifest file? When building asset bundles I get 2 files, one is the assets and another is the manifset. I upload only the assets (big file) to my server and ignore the manifest, which works fine, but in that case does it mean I can't use caching? The reason I only upload one file is because UnityWebRequestAssetBundle downloads one file.
Build asset bundle-
static void BuildABs()
{
BuildPipeline.BuildAssetBundles("Assets/abs", BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.iOS);
}
Load Asset Bundle
using (UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle(url))
{
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.Log(uwr.error);
}
else
{
// Get downloaded asset bundle
myLoadedAssetBundle = DownloadHandlerAssetBundle.GetContent(uwr);
}
Comment