2

My game have 100M asset bundles, I put the budle files into the StreamingAssets folder(I want to release my apk as one whole app, not the downloading when playing style), then I built my project into one apk file, then I installed the apk file to my device.

But how can I update my bundles when my game find one new update is available? The StreamingAssets folder on Android is read-only.

One solution is that: copy the bundles in the StreamingAssets folder to somewhere like the Android's External Storage, then use bundles in the External Storage. But this will increase my game size from 100M bundles to 200M.

So on Android when I install one apk, can I install some files meanwhile into somewhere writable?

Anyone can help me? Thanks.

user3171615
  • 23
  • 1
  • 4
  • What happened on my Android device is that `WWW.LoadFromCacheOrDownload` will create one cache when loading bundles from the StreamingAssets folder. The log from logcat is like that: D/Unity (24031): jar:file:///data/app/cn.com.lingosoft-1.apk/!/assets/1-testlingotm_n_nolitu01_test.assetbundle cached to /mnt/sdcard/Android/data/cn.com.lingosoft/files/UnityCache/Shared/6eff2dfde41f955b1b032ede1f42a330eb0dfb09 D/Unity (24031): loading from cache: jar:file:///data/app/cn.com.lingosoft-1.apk/!/assets/1-testlingotm_n_nolitu01_test.assetbundle @Roberto – user3171615 Jan 24 '14 at 02:17

1 Answers1

1

Not sure if I understood: you shouldn't use asset bundles if you are not, at some point, going to update them or have new assets to download in-game.

So just use regular prefabs and use the regular Android update process to update the application.

But if you want to have asset updates in-game then you use asset bundles, put them on StreamingAssets and use WWW.LoadFromCacheOrDownload(string url, int version) to load them; when a new version of your asset is available you change the version in that call and it will just download and cache the new version.

Roberto
  • 11,557
  • 16
  • 54
  • 68
  • I want to have asset updates in-game, and I put them on StreamingAssets. But if I use WWW.LoadFromCacheOrDownload to load and update the bundles, it will create one cache of the bundles increasing my game from 100M to 200M. That's why I post my question. – user3171615 Jan 08 '14 at 06:16
  • It won't copy from StreamingAssets to the cache. – Roberto Jan 08 '14 at 10:49
  • `WWW.LoadFromCacheOrDownload` won't copy from StreamingAssets to the cache? – user3171615 Jan 09 '14 at 05:39
  • What I think is that: in the first time, the bundles is not present in the cache, so `WWW.LoadFromCacheOrDownload` will load the bundles from the StreamingAssets folder and store them in the cache. – user3171615 Jan 09 '14 at 05:53
  • unless the file names changed, that's not what's happening in my computer. – Roberto Jan 09 '14 at 05:57
  • Do you mean that: on Android `WWW.LoadFromCacheOrDownload` won't create one cache when loading bundles from the StreamingAssets folder, but will create one cache when loading bundles from the WEB? – user3171615 Jan 09 '14 at 06:09
  • Yes. It will only create in the cache when it doesn't find in `StreamingAssets`. – Roberto Jan 09 '14 at 06:11
  • [The document](http://docs.unity3d.com/Documentation/ScriptReference/WWW.LoadFromCacheOrDownload.html) even doesn't mention the relationship between `WWW.LoadFromCacheOrDownload` and `StreamingAssets`. Thank you very much. – user3171615 Jan 09 '14 at 06:28
  • Get used, the documentation is far from complete... For example, it says to use a URL, but it works with a URI also. It could mention that. – Roberto Jan 09 '14 at 06:36
  • OK, I get it. Thanks for your patience. My last question is where does the cache folder locate on Android. – user3171615 Jan 09 '14 at 06:44
  • I don't know, I use WindowsPhone :P Sure you can easily google this. Or open another question on StackOverflow. – Roberto Jan 09 '14 at 06:50