- Home /
Question by
Programmer · Mar 03, 2014 at 06:08 AM ·
androidassetbundle
Why I am not able to load asset bundle from android device?
Hi everyone,
I am facing another problem on loading asset bundles from external device. I have a asset bundle in application persistance path yet I am not able to load it in my application. When I tracked the log it shows as screen shot attached. Help me to come out from this problem.
My Code
using(WWW www = WWW.LoadFromCacheOrDownload("file://" + Application.persistentDataPath + "/1001/" + "model.unity3d",0))
{
yield return www;
if(www.error !=null)
cd.text = www.error.ToString();
else
cd.text = "No error";
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Application.LoadLevel("loadmyLevel");
}
Comment
Answer by Programmer · Mar 03, 2014 at 05:18 PM
Hi
I found the problem. We have to create asset for and round platform. The problem solved.
Answer by felixwcf85 · May 25, 2015 at 08:17 AM
Update for the answer:
Use
BuildPipeline.BuildAssetBundles ("AssetBundles", BuildAssetBundleOptions.None, BuildTarget.Android);
on your assetBundleCreator script.
I'm trying this:
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android);
BuildPipeline.BuildAssetBundles("AssetBundles/android", BuildAssetBundleOptions.ForceRebuildAssetBundle, BuildTarget.Android);
But the log always appears:
02-16 00:42:30.230: E/Unity(31702): The file can not be loaded because it was created for another build target that is not compatible with this platform.
02-16 00:42:30.230: E/Unity(31702): Please make sure to build AssetBundles using the build target platform that it is used by.
02-16 00:42:30.230: E/Unity(31702): File's Build target is: 6