- Home /
Unity compiles assets from previous builds into an empty scene?
I notice Unity stuffs assets I've used for scenes in previous Builds into a Blank scene. (My builds have been getting bigger and bigger as a result of this 'leak'. To isolate the issue, I am Building a completely empty scene, but the Builder still thinks there are assets that should belong to it, thus making a huge blank webplayer.unity3d. At first it was 90Mb! So i deleted tons of assets i don't use anymore, and luckily Unity gave up looking for those, but this continues to be a problem.. Does anyone know if there is a file somewhere that I can clear/reset so it will rediscover what I actually need in a scene?
That is correct. Only ONE blank scene is in the build options list for this test.
I noticed this issue at first because I had added a huge jungle pack to my assets folder, (but I had only used one little tree from the pack in my project) .. and to my dismay, my next build was 80$$anonymous$$b larger! Looking at the Editor Log, I saw what appeared to be every texture in the entire pack was being added! And upon closer exa$$anonymous$$ation, I realized there is not really any rhyme or reason to what assets it believes are 'used' in a scene. But it always insists on the same particular assets, until I completely remove one of them from the project folder. This temporarily cures the issue for that asset, but when I put that asset back into ANY folder, and even RENA$$anonymous$$E it .. it grabs it again for any scene I build, even if that ONE build-scene is completely empty. Strange. $$anonymous$$aybe should submit bug report? I wanted to try asking here first because perhaps another developer knows how this might happen. $$anonymous$$y first theory was maybe a build will insist certain assets are used because of which folder they are sitting in, or there might be some setting somewhere that forces certain types of assets to always be included. Any one have any clue? ;)
I am curious about where this may lead. $$anonymous$$y builds have also seemed bigger than they should be, but I thought "I will optimize those textures later", but maybe I am also suffering from asset leakage... who knows... :)
Answer by Martian-Games · Oct 08, 2012 at 08:06 PM
SOLUTION! (Destroy those Hidden Resources Folders!!!)
User 'whydoidoit' points out: Anything in a Resources folder will be included whether it is referenced or not.
Now, I assumed that this only applied to a Resources folder at the highest level .. BUT this is in fact true for ANY 'resources' folder found anywhere! So, if for example you wantto use the 'Tropical Nature Pack' - (from the unity store), you will find hundreds of assets tucked away in gobs of hidden 'resources' folders, thus an empty scene in your project will build up to 80Mb, even though you may not reference any of these hundreds of assets! The Solution is: KILL ALL THESE UNNECESSARY RESOURCE FOLDERS! Phew Thanks for pointing this out Mr. 'whydoidoit' !! :)
Answer by G_Koko · Oct 18, 2012 at 12:32 PM
Hi Steve, i have the same issue right now, when i build an empty scene the size of the app go to 300MB! It's insane. How you do that "Destroy hidden resources folder"?
Thanks
The best method might be:
go to your 'Project' Tab
type in the searchbox: 'resources'
rename all those results: 'res' (or anything else) ins$$anonymous$$d
now, when you run your game you will discover which resources you were actually trying to load using the Resources.Load() command .. now if you encounter any: simply rename ONLY those Resources folders that you actually need (back to 'Resources') for your current project!
or, you could use $$anonymous$$onodevelop to (ctrl-shift-F) search all files in 'Whole Solution' for this text: Resources.Load("
.. and then find exactly which folders those files you are loading are residing.. and rename the folders you don't need.
:)