Use the 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 Build Settings to configure how Unity builds your application for the WebGL platform.
To access the Build Settings for WebGL:
Go to File > Build Settings.
Select WebGL.
The following table gives an overview of the WebGL Build Settings.
Setting | Function | |
---|---|---|
Texture CompressionA method of storing data that reduces the amount of storage space it requires. See Texture Compression, Animation Compression, Audio Compression, Build Compression. See in Glossary |
The texture compression3D Graphics hardware requires Textures to be compressed in specialized formats which are optimized for fast Texture sampling. More info See in Glossary format to use for the build. For more information, refer to WebGL texture compression. |
|
Use Default Format (DXT) | Uses DXT, the default compression format. | |
ETC2 | Uses ETC2 format, which is widely supported on mobile devices. | |
ASTC | Uses ASTC format, which is widely supported on mobile devices. | |
DXT | Uses DXTn/BCn compression format. | |
Development BuildA development build includes debug symbols and enables the Profiler. More info See in Glossary |
Enable this setting to include scripting debug symbols and the Profiler in your build. When you enable this, Unity sets the DEVELOPMENT_BUILD scripting define. Use this setting only when you want to test your application because development builds don’t minify content, they’re large to distribute. |
|
Code Optimization | Select the optimization mode to use for compiling the WebGL code. | |
Speed | This is the default setting. Select this option to generate WebGL code that takes the least amount of time to build. | |
Size | Select this option to favor optimizations that minimize build size, at the expense of taking a longer time to build. The recommended best practice is to select this option when targeting mobile web browsers, that may have limits on the size of WebAssembly files that can be loaded. Smaller disk sizes generally result in shorter page startup times. | |
Autoconnect Profiler | Typically, when enabled, this setting allows you to automatically connect the Unity Profiler to your build. However for WebGL, as you can’t connect the ProfilerA window that helps you to optimize your game. It shows how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating, or in your game logic. More info See in Glossary to a running build, use this option to connect the content to the Unity Editor instead. This is because the Profiler connection is handled using WebSockets on WebGL, but a web browser only allows outgoing connections from the content. For this setting to be available, you must enable the Development Build option. |
|
Deep Profiling Support | Enable this setting to activate Deep Profiling in the Profiler. This makes the Profiler instrument every function call in your application and returns more detailed profiling data. When you enable Deep Profiling Support, it might slow down script execution. This option is only available if you enable the Development Build option. | |
IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info See in Glossary Code Generation |
Define how Unity manages IL2CPP code generation. | |
Faster runtime | Generates code that’s optimized for runtime performance. This is the default behavior in previous versions of Unity. | |
Faster (smaller) builds | Generates code that’s optimized for build size and iteration. It generates less code and produces a smaller build, but might have an impact on runtime performance, especially for generic code. You might want to use this option when faster build times are important, such as when iterating on changes. | |
Build | Use it to build your application. | |
Build And Run | Use it to view the WebGL Player locally. Unity uses a local web server to host your build, and opens it from a localhost URL. Alternatively, you can use a custom local web server with properly configured response headers. For more information, see Compressed builds and server configuration. |
For changing the settings for Asset Import Overrides, refer to Build Settings.