Version: Unity 6.3 LTS (6000.3)
Language : English
Use C# code to enable optimization settings
Optimize Web platform for mobile

Remove unused resources from your Web build

Remove unused packages, shadersA program that runs on the GPU. More info
See in Glossary
, and engine code from a project to make the build smaller. A smaller build reduces application load times and improves the performance of your application.

Remove or disable unused packages

Unused packages might affect the final output size of the build. Remove or disable all packages the project doesn’t use. This includes built-in packagesBuilt-in packages allow users to toggle Unity features on or off through the Package Manager. Enabling or disabling a package reduces the run-time build size. For example, most projects don’t use the legacy Particle System. By removing the abstracted package of this feature, the related code and resources are not part of the final built product. Typically, these packages contain only the package manifest and are bundled with Unity (rather than available on the package registry).
See in Glossary
and packages that might be enabled by default, such as the Input System package, which can significantly increase the build size if it’s not removed.

You can use the Package Manager window to determine which packages are installed or enabled for your project:

  • Select the In Project view and check the list panel for packages that are installed as direct and indirect dependencies. You can also use the details panel to get more information about packages dependencies.
  • Select the Built-in view for built-in packages that are enabled in your project.

To learn which packages your project needs, review the project manifest file located at Packages/manifest.json.

To remove a package, refer to Remove a UPM package from a project.

To disable a built-in package, refer to Disable a built-in package.

Remove unused shader variants

Enable shader stripping to remove shader variants that aren’t used in a sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
. Shader stripping can reduce your build file size.

Important: Test your application to make sure your unused shaders aren’t referenced by other shaders.

To enable shader stripping, refer to Graphics.

Remove unused engine code

Use the Web Stripping Tool package to identify and remove unused engine code from your build. This tool is useful for projects that don’t use certain engine features, such as 3D graphics in a 2D game, allowing for a significant reduction in the final build size.

Additional resources

Use C# code to enable optimization settings
Optimize Web platform for mobile