Version: 2022.3
Language : English
Recommended Player settings to optimize your WebGL build
Use C# code to enable optimization settings

Recommended Quality settings to optimize your WebGL build

Use the following recommended Quality settings to optimize your builds for the Unity WebGLA JavaScript API that renders 2D and 3D graphics in a web browser. The Unity WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering API to run Unity content in a web browser. More info
See in Glossary
platform.

Configure the following recommended settings in Edit > Project Settings > Quality. For more information on these settings, refer to Quality.

Quality Level

The Quality settings contain a group of possible Quality Levels for your build. If you set your Quality Level to a lower setting (Fastest or Fast), it results in faster load times and better performance which is recommended for a WebGL application. However, lower quality can mean the visuals don’t look as good.

For more information about this setting, refer to Quality.

Change the Quality Level via C# code

To change the Quality Level via script instead, add this code to one of your scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary
:

QualitySettings.SetQualityLevel(0, true); // Use the index of your quality settings matrix (0 = Fastest, 1 =  Fast). 

Additional resources

Recommended Player settings to optimize your WebGL build
Use C# code to enable optimization settings