3
\$\begingroup\$

The only way to load an asset from an asset bundle into memory is to load the entire thing, decompress and pull out the asset you want, then unload the entire thing, except the assets you want. This seems impractical for sharing assets between bundles. For example, if asset bundle A wants a single asset from asset bundle B, it must load all of B, pull out the asset, then destroy B. The alternative to this is to extract the shared assets and create a new bundle call asset bundle C. The problem with this is that B must have been designed this way before being built, which it won't be if it was built before A (it has to be since A depends on B).

Using the resources folder results in a huge blob of bytes that, from what I understand, cannot be changed after build, and is certainly not differ able for patches.

Putting the pros of asset bundles and the resource folder together, I figure that having an asset bundle for every asset is the best of both worlds. Is there problems with this? Is my understanding of asset bundles or the resource folder flawed?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You are correct in your assumptions. For our project we have an editor script which runs through all our assets, packs some of them into small bundles and saves information about each bundle into config. When we need to load something at runtime our system determines whether it should fetch data from Resources or asset bundles. This way we can adjust our build size and memory footprint. The hard part with this approach is to correctly unload bundles after you are done with them, otherwise you can end up with memory leaks or black textures. Also keep in mind that loading a bunch of small bundles is way slower than loading one big bundle, it can significantly hurt user experience.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .