Assert bundles in the data folder

Hello,

Does anyone know how to add items to the apk, pre or post build? I need to add asset bundles to the package and load them later at runtime. Does the Application.dataPath point to the package on the Android?

The way I’ve gone about it is to decompose the apk using apktool, add the assets I need, then repackaging the apk with apktool (but you will need to sign it again on your own afterwards before you can install it - unity does that for you). It’s not pretty, but it works.

Just create the folder StreamingAssets in your project, but all the stuff you need and it all will be packed to the apk and will be deployed into app directory on the device

Hello, Thanks for the info … But how do I load the bundles from this location?

With pre 3.2 I guess you don’t. With 3.2 you can use something like WWW(“jar:file://” + Application.dataPath + “!/assets/”);, if is under Assets/StreamingAssets.

Correction:
var www: WWW = new WWW(“jar:file://” + Application.dataPath + “!/assets/<file_name>”);
yield www; // loading
guiTexture.texture = www.texture;

hmm I’m still having trouble loading from that path, i’ve actually checke the .apk file and it does have the correct files in the assets folder.

Does the logcat give any additional hints?

When building assets bundle (BuildPipeline.BuildAssetBundle), don’t forget add “BuildTarget.Android” paramater, or the data will not be loaded even the path is correct.