Search Unity

Caching on the IOS

Discussion in 'iOS and tvOS' started by Digitalos, Feb 20, 2011.

  1. Digitalos

    Digitalos

    Joined:
    Jun 1, 2009
    Posts:
    112
    Hey guys, I don't usually post here, or on the forum at all in fact, but I've been trying to get this working for a few days now and am simply not sure what the dealio is. I have followed the docs on the Unity IOS Docwiki and have my game writing assetbundles to the IOS device in the var/mobile/XXXX-XXXX-XXXX/Documents folder or whatever it is, I can't recall offhand. I have it printing logs to the console and screen and it shows it writing the bundles so all is good. On next launch, it tries to read the bundles that were previously written, and it fails, saying the url is invalid. The console/screen debug print the exact same URL path from when they were written, and it obviously finds the files there, as I use:

    Code (csharp):
    1. string[] filePaths = Directory.GetFiles( mDiskAssetPath, "*.assetbundle" );
    Where mDiskAssetPath is the path to the local Documents folder, to get the files, and it picks up a number equal to the number that was written, then promptly yells at me about the url being wrong - oh, the url in this case is the string path, not an actual http url, I just call it URL as that's the parameter name I pass to the function. So anyhow, I find that a bit perplexing, it finds the files I want to load, tries to load them, and says 'no'. :<

    Has anyone gotten it working, and may be able to shine some light on the issue for me?
    Thanks. :)
     
  2. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I guess you are loading local asset bundles via WWW class. In such case you need to prepend "file://" to your asset bundle path before passing it to the WWW class.
     
  3. Digitalos

    Digitalos

    Joined:
    Jun 1, 2009
    Posts:
    112
    Hi mantasp, the docs don't mention this, in their examples there is no "file://" prepended to the url, however I will try this and report back. Thanks for the help.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    when you use WWW there needs to be a file or it will be on the WWW
    if you use System.IO.File then you don't need the file:// cause its always only on the file system