UI prefabs in bundles are taking huge large size

Hello community!

I am using Unity 5.1.1p4 and I have being dealing with this question about the size of my bundles.

The thing goes like this, I have a folder with my UI prefabs, just the prefabs, no other asset, no other resources, nothing else, but my prefabs. I have 22 of them and they occupy 1 Mb exactly in my unity project folder. Then I mark them to a bundle and I build the Asset Bundles.

When I check the size of the prefab_ui bundle is 26 Mb! How can 1 Mb of text can grow to 26 Mb instead of been compressed!

If I don’t use UI elements then the size is been compressed, as expected, for instance my managers prefab folder occupy 19.4 Kb and the bundle for this is 4.2 Kb, completely reasonable!

Can anyone on Unity could please explain if something is being added to the bundle that the UI prefabs need? or this is just some kind of bug.

I know that in Unity 5.2.0x the size for bundles using sprite atlases will decrease a lot but even using the beta that will not be the case in this matter.

Best regards,

— EDIT: —

I found the Actual Reason!! Here it goes:

The reason for why this is happening was that one prefab was taking references from assets that were inside a project folder, therefore by not being inside another bundle the build system was including them inside the bundle itself. If those assets are references from another bundle then they qualify as a bundle dependency and they will not be included in the bundle, which is why the final bundle size was so huge.

Now two things about this, first: Why we are not getting a correct log in the .manifest file to be aware about this? That would be nice to have so we can keep track of all the assets that actually ship with the bundle.

and second: That could also help us solve the problematic inconsistent asset issue and help us detect where one prefab is making a reference to multiple bundle variants.

It would also be nice to hear from Unity guys about the PreloadTable from the image I also posted below.

Hope this helps everybody!
Thanks a lot!

Edit: The actual answer is in the original post.

Here is the probable reason!! I am attaching a picture which shows the amount of items in the Preload Table of the bundle, and the amount is 12343.

If those assets are being shipped alongside the bundle, then that is the reason why the bundle size has the monstrous cipher of 26 Mb when the bundle originally was suppose to have 22 prefab items only, those are actually into another array called Container which is correct.

Can anyone on Unity explain a little bit about the Preload Table, it is a list of references that are updated with the bundle load? or is the list of attached resource dependencies and they ship with the bundle? and why those references are not being loaded from their respective bundles? since the manifest declares the dependencies correctly from the other 3 bundles where my assets really are.

Hope this is well explanatory to help other people having the same issue.
Please have a nice day! :slight_smile: