- Home /
Understanding AssetBundles (WWW) BuildPipeline
I'm trying to get my head around Unity's AssetBundle class, which allows me to export assets, and then download and import them over the web.
The issue I'm having is that my Unity project is for iOS, so every time I run the 'BuildAssetBundle' example found here: http://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundle.html
It changes my build platform from iOS, to Web Player and then exports out successfully. When I change my build platform back to iOS and play within the editor, it successfully downloads the asset bundle from my FTP (WWW), but when I try it on my iPhone, it crashes. Here is the log:
The file can not be loaded because it was created for another build target that is not compatible with this platform. Please make sure to build asset bundles using the build target platform that it is used by. File's Build target is: 6
Do you think it has something to do with the fact its changing the build platform from iOS to Webplayer? And then me having to change it back?
Thanks.
----- UPDATE -----
I found that if I put 'BuildTarget.iPhone' within the 'ExportAssetBundle' example script - it keeps my built platform to iOS. Still works within the Editor, but same error on my iPhone, same log. (And yes, I have uploaded the new bundle to my FTP).
I am not sure how IOS builds cache the asset bundles but you may want to look into cleaning the cache here : http://docs.unity3d.com/ScriptReference/Caching.CleanCache.html
I tend to forget to clean the cache and end up not downloading the new assetbundle with LoadFromCacheOrDownload.
Answer by ajketan · Jul 02, 2014 at 01:00 PM
Here is a very useful editor script that I got from Sergey Taraban ..... I did not find the link to the actual file so uploading one for you.
Please find it here: AssetBundleExporter
This allows you to choose your platform for creating asset bundle and also you can manage the split size of your asset bundle... this proved very helpful to me.
Hope it does the same for you.
Thanks, although you haven't supplied a link to your upload :/
Your answer
Follow this Question
Related Questions
C# IEnumerator Function Inheritance Dilemma 1 Answer
Why does building bundles cause unload unused assets to be called? 1 Answer
Can asset bundled scenes contain original tags which can be read when downloaded? 1 Answer
Assetbundle materials? 1 Answer
Getting "The unity3d file is not a valid asset bundle" error 0 Answers