- Home /
Can't load objects from asset bundle when using AssetBundle.CreateFromFile
I have an uncompressed asset bundle with a main asset and multiple additional assets. If I load the asset bundle using WWW.LoadFromCacheOrDownload()
everything is fine. However, I do not want to use the cache as the bundles are already on disk and rather large.
AssetBundle.CreateFromFile()
does load the asset bundle. It reads the main asset and I can check to see if the assets are in the file using Contains()
. However, when I try to load them Load()
returns null.
I am building my asset bundles like this:
BuildPipeline.BuildAssetBundle(mainAsset, arrayOfObjects, savePath, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.iPhone, BuildOptions.UncompressedAssetBundle);
Is there something I am missing either in my build process or in how AssetBundle.CreateFromFile()
should be used?
Answer by Robert-Castle · Feb 15, 2013 at 01:27 PM
No, sorry. I ended up just using LoadFromCacheOrDownload with the version set to 0, which I believe avoids caching (I would have to check the Unite 2012 video "Asset Bundles : Creative Uses and Best Practices" to be sure).
I have not tested it in Unity 4 yet, either.