- Home /
Why do shaders take up 21% of the overall build?
Hi,
I use only a handful of mobile shaders in my game. However the build report shows over 21mb of shaders included in the build! Where do they come from and is it possible to reduce this number?
Build Report
Uncompressed usage by category:
Textures 26.4 mb 54.8%
Meshes 1.2 mb 2.6%
Animations 11.0 kb 0.0%
Sounds 638.4 kb 1.3%
Shaders 12.1 mb 25.1% <<< HUGE!!!
Other Assets 2.1 mb 4.4%
Levels 0.3 mb 0.6%
Scripts 1.2 mb 2.4%
Included DLLs 3.9 mb 8.2%
File headers 329.8 kb 0.7%
Complete size 48.2 mb 100.0%
Could this be something to do with Variants being included?
Answer by routitsm · Feb 03, 2018 at 05:09 AM
I found it - the Broadleaf_Mobile from Standard Assets drags along with it 9Mb worth of shaders, textures and materials into the build. Not very "mobile", considering you are ideally trying to fit your game into a 100mb package.
Answer by wilfy · Jan 30, 2018 at 01:23 PM
https://aras-p.info/blog/2015/01/14/optimizing-shader-info-loading/
Looks like this was/is a bug? What version are you running?
Answer by DanVioletSagmiller · Jan 30, 2018 at 01:25 PM
Shaders typically are small, but depending on the amount of work done, a shader may have a different implementation for every system unity supports. What are your shader file sizes? I still find it hard to imagine 12 megs of shaders though. Can you share what shaders you are using?
Also, you could try putting the shaders in another project, attaching a simple material/object in a scene to each, build, then remove each shader 1 by 1 to see which is taking the most space. Depending on where/how you got the shader, you could probably talk to the developer of it for advice, or find a different shader.
I am using $$anonymous$$obile Diffuse and Vertex Lit for own models.
Some 3rd party assets use Nature/Speed Tree shaders and also some particle shaders for car effects, smoke etc.
I suspect it could be the Speed Tree shader. I saw some large numbers in the editor log file to do with the SpeedTree shader. Is there any shader for mobile that is like transparent diffuse? The Speed Tree shaders feel very bloated...
Your answer
![](https://koobas.hobune.stream/wayback/20220612151611im_/https://answers.unity.com/themes/thub/images/avi.jpg)