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

Remove unused resources from your WebGL build

Remove unused packages and shadersA program that runs on the GPU. More info
See in Glossary
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 enabled by default, such as the Input System package, which can double the build size if it’s not removed.

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.

Additional resources


对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答
Use C# code to enable optimization settings
Optimize WebGL platform for mobile
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961