- Home /
Unity Asset Bundles Android
I am currently trying to build an app that downloads asset bundles at runtime for mobile devices. I have got it to work on the web-player but have found issues trying to get it to work on android. I have tried adding the BuildTarget.Android and it built a different asset but when I try download it I get a 404 file not found error, I have triple checked my link and uploaded multiple files, it just seems that it does not recognise the android built asset.
using (WWW www = WWW.LoadFromCacheOrDownload("http://luminaryserver.com/LuminAR/Luminary/android.unity3d", 0)) {
yield return www;
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
AssetBundle bundle = www.assetBundle;
mBundleInstance = Instantiate(bundle.Load ("Cube")) as GameObject;
I build the assets like so:
[MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
static void ExportAssetBundleComplete() {
// Bring up save panel
string path = EditorUtility.SaveFilePanel("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0) {
// Build the resource file from the active selection.
//
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
//
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.Android);
Selection.objects = selection;
//
}
}
Thanks in advance for any help
Your answer
Follow this Question
Related Questions
Does AssetBundle work on mobile? 0 Answers
Spotlight Does not Show Up In Android Builds 3 Answers
How to handle many highly detailed models in a mobile device ? 1 Answer
Google Play Realtime Multiplayer Only Works On One Account 0 Answers
Back button does nothing when keyboard is open (Android, Pixel 3 XL, unity 2019.2.7f2) 1 Answer