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,
Lermy
— 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!
Lermy