|
Hi, I'm trying to build unity player as small as possible, so I decided to put all assets into a asset bundle and keep only levels with scripts in main application. I have successfully created both application and bundle, but I'm stuck on loading only required assets for a single level. What I'm doing now is loading all assets from bundle at application startup and mark them by DontDestroyOnLoad, so they are kept in memory when a level is loaded. While this is hardly final solution, I'm looking how to load only assets needed for a particular level, preferably without much hassle. So I'm looking for a way how load a level and let Unity to load and instantiate required assets from asset bundle, just as they were part of the application. Is this possible? Or do I need to do it a hard way? (i.e. to generate list of required assets and manage their loading and unloading manually for example) Thanks in advance!
(comments are locked)
|
|
first of all if you load something from asset bundle you can cache it in new versions and even without caching they will remain in browser's cache at least in current session so redownload will not happen and you don't need to keep track of them. why don't you use streamed web players? just check the box called streamed in web player build and then unity will load levels one by one with their required assets. you can load downloaded levels and let the user play the game while downloading next levels. it's easy and is exactly what you want. at first all headers/scripts/ will be downloaded with the first scene assets. then the player starts playing while downloading second scene and so on. if you are using a platform other than web player unfortunately there is not an easy way to do that. you should create an asset bundle of all required assets in a level and use AssetBundle.LoadAll to load them all when download is complete. Thanks for tip Ashkan, unfortunately I'm doing it for android, so streamed web player is out of question.
Mar 15 '11 at 02:06 PM
Jirka United
ok i added a way to make it possible for none web players to load it all easily. not as easy as that but easy.
Mar 15 '11 at 07:19 PM
Ashkan_gc
Thanks Ashkan, although this is exatly waht I would prefere to avoid, I may give it a try. Is it really easy to obtain list of all assets for a level? Do you know how to do that?
Mar 16 '11 at 04:44 PM
Jirka United
currently i don't remember but if you could find a way to get the surely it's easy. just select the scene file and create the asset bundle from it and tell it to include all dependencies. boom, it will collect them all. i tested more than a year ago with my unity pro trial but after buying unity never i needed it.
Mar 17 '11 at 08:49 AM
Ashkan_gc
Ok Ashkan, thanks for helping
Mar 17 '11 at 10:41 AM
Jirka United
(comments are locked)
|
