- Home /
Can you build a single assetbundle which can be used on multiple platforms?
I would like to do something like this:
BuildPipeline.BuildAssetBundle(mainAsset, assets, pathName, BuildAssetBundleOptions.CompleteAssets, BuildTarget.WebPlayer | BuildTarget.iPhone)
But the last parameter (BuildTarget.WebPlayer | BuildTarget.iPhone) is giving me troubles when running the code, its all fine by the compiler btw. Unity basicly tells me you can't build assetbundles for iPhone when on Windows.
I thought assetbundles would be the same for all platforms. After all its Unity's own byte format.
Answer by Robert-Castle · Aug 10, 2012 at 04:41 PM
http://docs.unity3d.com/Documentation/Manual/abfaq.html details which platforms asset bundles will run on. You need a different asset bundle for iOS, Android, and standalone (Win, Mac). Webplayer should work with standalone builds according to the grid (not personally tested).
I believe the reason is that the bundles get stripped down and optimised differently for iOS and Android to make sure they load as fast as possible. There may be other issues too, such as Endianness.
This link provides a useful summary about asset bundles: http://docs.unity3d.com/Documentation/Manual/AssetBundlesIntro.html
Annoyingly the FAQ above is not linked from that page, you have to go to here: http://docs.unity3d.com/Documentation/Manual/Advanced.html