Created new project URP 3D for WebGL platfom. Disable postprocessing. Removed unneeded modules and packages.
One simple scene with lonely cube.
Build size is almost 10 Mb! In build report I see some stuff I definitely not need. For example:
- Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader
or:
- Packages/com.unity.render-pipelines.universal/Shaders/Debug/HDRDebugView.shader
Also, I have a lot of ddebug UI widgets in build such as:
- Packages/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIPanel.prefab
- Packages/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Widgets/DebugUIUIntField.prefab
etc…
Also:
Packages/com.unity.render-pipelines.core/Runtime/Debugging/Prefabs/Fonts/PerfectDOSVGA437.ttf - almost 80 Kb.
How to get rid of this? I don’t need it in my build!
A minimal build size is closer to or even less than 5 MB. So you haven’t pulled every trick in the book to reduce the build size. I suspect you may have done a develop/debug build rather than a release build. Also if you keep building to the same folder, it may not delete all previously created files.
There’s also important Player Settings like setting Code Stripping to High that reduce build size.
You also want to first disable the “Show Unity logo” checkbox before disabling the “Show splashscreen” checkbox in Player Settings, this will remove the logo image from the build.
In Package Manager, check which “built-in” package you could remove. For instance things like Wind, Vehicles, Cloth, Terrain, Physics2D are likely options - however some code and specifically assets may depend on these and throw compile errors if they are disabled.
See my post here and the start of the thread for the repository and automated build size tests.
A minimal build size is closer to or even less than 5 MB. So you haven’t pulled every trick in the book to reduce the build size. I suspect you may have done a develop/debug build rather than a release build. Also if you keep building to the same folder, it may not delete all previously created files.
There’s also important Player Settings like setting Code Stripping to High that reduce build size.
You also want to first disable the “Show Unity logo” checkbox before disabling the “Show splashscreen” checkbox in Player Settings, this will remove the logo image from the build.
In Package Manager, check which “built-in” package you could remove. For instance things like Wind, Vehicles, Cloth, Terrain, Physics2D are likely options - however some code and specifically assets may depend on these and throw compile errors if they are disabled.
I did every single point from this list even before creating this thread. Build size is still bigger than 9 Mb.
I remember that in 2021 version Web builds were smaller, but looks like it’s not the case anymore in 6000.
P.S. Well, something around 0.3-1 Mb to the size of final build added by web template. But still, its closer to 9 Mb total.
Thank you! Will look into it.
Hey. For minimal build size, I would recommend Built-In Renderer over URP as the latter currently introduces an unfortunate amount of size overhead, especially for Web builds.
If you search, there should be a few similar threads on this same topic with good tips. Also check out this: Unity 6 "empty" web build file sizes · GitHub
We also released a package called Web Stripping Tool recently, I recommend checking out if the helps. Web Stripping Tool package | Web Stripping Tool | 1.1.0 Even for an empty project, it should be able to strip away some native engine code that won’t be stripped usually.