Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity on iOS is caching my asset bundle without me asking it to!

Discussion in 'Editor & General Support' started by holyfuzz, Jan 8, 2014.

  1. holyfuzz

    holyfuzz

    Joined:
    Nov 16, 2010
    Posts:
    21
    Hello,

    I've run into a perplexing problem where my Unity app on iOS appears to be caching an asset bundle, but I DON'T want it to be cached!

    This is how I'm downloading the asset bundle:

    Code (csharp):
    1.  
    2.         WWW www = new WWW("http://urlofassetbundle");
    3.         yield return www;
    4.         AssetBundle bundle = www.assetBundle;
    5.  
    Note that I'm *not* calling WWW.LoadFromCacheOrDownload here, nor is it called anywhere else in my code.

    Once an asset bundle is downloaded from that URL, Unity appears to cache it on my iPad, such that any future updates to the asset bundle won't get downloaded. In order to "un-cache" the asset bundle, I have to delete the app from my iPad and reinstall it -- killing the running app process is not sufficient.

    What's going on here? How can I prevent Unity from caching my asset bundle? I'm using Unity 4.2.2f1.

    Thanks for your help!
     
  2. holyfuzz

    holyfuzz

    Joined:
    Nov 16, 2010
    Posts:
    21
    Anyone else having this problem? Does anyone have any idea what's going on?
     
  3. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Just for kicks do this:

    Code (csharp):
    1.  
    2. WWW www = new WWW(string.Format("http://urlofassetbundle?nc={0}",Guid.NewGuid().ToString()));
    3. yield return www;
    4. AssetBundle bundle = www.assetBundle;
    5.  

    Adding the ?nc=(random guid here) should cause the device to treat it as a separate call and not cache it.
     
  4. holyfuzz

    holyfuzz

    Joined:
    Nov 16, 2010
    Posts:
    21
    Good idea, I'll try that. Thanks!