My development enviroment is Unity Pro 3.3, Android Pro, and Windows Xp.
I try to make my own avatar system with CharacterCustomization Sample.
But on Android, I can't load data of assets via AssetBundles.
On Windows, I succeeded to load assets via AssetBundles.Load() with WWW class.
But on Android, same program does not work well.
I can't load data.
How do I load data of assets on Android ?
I've got the answer.
Points are these.
- Use the option "BuildTarget.Android".
- Describe the path with triple slash "file:///"
I did it with these processes.
- Delete directories "Per Texture Materials", "assetbundles", and so on.
- Use the option "BuildTarget.Android" to all "BuildPipeline.BuildAssetBundle".
- Run these on Editor.
Character Generator/Generate Materials
Character Generator/Create Assetbundles
Character Generator/Update Character Element Database
- Copy Assetbundles database to Android device which like "/mnt/sdcard/assetbundles/"
- Modify AssetbundleBaseURL. (the point was "file:///")
public static string AssetbundleBaseURL
if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
return Application.dataPath + "/assetbundles/";
else if (Application.platform == RuntimePlatform.Android)
return "file://" + Application.dataPath + "/../assetbundles/";
AssestBundles need to be made specifically for the target you want to use them on for it to work. It took a lot of swearing and head banging to figure this out. The docs should specify this. Once you make it for the android (or in this case, re-make them) it should work.
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.Android);
notice the optional param BuildTarget.Android
If i do not want to Copy the AssetBundle ,Can i package the assetBundle in an apk !wich floder should i place the assetBundle !If i put the assetBundle in Assets floder the Code can not find the AssetBundle!
I've Got the same Problem just like U've.
Feel Sad Badly.
Thanks, Victor! You saved the day with that comment! I don’t know if I ever would have found that about the BuildTarget.Android if you didn’t mention it. I made that one change and then it worked! Awesome!