这是用户在 2025-4-30 15:25 为 https://docs.unity3d.com/2022.3/Documentation/Manual/class-PlayerSettingsWebGL.html#Other 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
Language : English  语言:英语
WebGL development
Interaction with browser scripting

WebGL Player settings  WebGL 播放器设置

Use Player settings to know how Unity buildsThe process of compiling your project into a format that is ready to run on a specific platform or platforms. More info
将您的项目编译成可在特定平台或平台上运行格式的过程。更多信息

See in Glossary  查看术语表
and displays your final 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
一个 JavaScript API,可以在网页浏览器中渲染 2D 和 3D 图形。Unity WebGL 构建选项允许 Unity 将内容发布为 JavaScript 程序,这些程序使用 HTML5 技术和 WebGL 渲染 API 在网页浏览器中运行 Unity 内容。更多信息

See in Glossary  查看术语表
application. For a description of the general Player settings, refer to Player settings.
使用播放器设置了解 Unity buildsThe process of compiling your project into a format that is ready to run on a specific platform or platforms. More info 
See in Glossary  查看术语表
以及如何显示您的最终 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
一个 JavaScript API,可以在网页浏览器中渲染 2D 和 3D 图形。Unity WebGL 构建选项允许 Unity 将内容发布为 JavaScript 程序,这些程序使用 HTML5 技术和 WebGL 渲染 API 在网页浏览器中运行 Unity 内容。更多信息

See in Glossary  查看术语表
应用程序。有关一般播放器设置的说明,请参阅播放器设置。

To access the WebGL Player settingsSettings that let you set various player-specific options for the final game built by Unity. More info
设置允许您为 Unity 构建的最终游戏设置各种特定玩家的选项。更多信息

See in Glossary  查看术语表
:
要访问 WebGL Player settingsSettings that let you set various player-specific options for the final game built by Unity. More info
设置允许您为 Unity 构建的最终游戏设置各种特定玩家的选项。更多信息

See in Glossary  查看术语表

  • From the Unity main menu, go to Edit > Project Settings > Player. The Player settings window appears.
    从 Unity 主菜单中,转到编辑 > 项目设置 > 玩家。玩家设置窗口出现。
  • Select the WebGL tab to view the WebGL Player settings.
    选择 WebGL 选项卡以查看 WebGL 玩家设置。
WebGL Player settings
WebGL Player settings  WebGL 玩家设置

You can find documentation for the properties in the following sections:
您可以在以下部分找到属性文档:

Note: Although the Icon panel appears on the WebGL Player settings, there are no icon settings available because WebGL games don’t use icons.
注意:尽管图标面板显示在 WebGL 播放器设置中,但由于 WebGL 游戏不使用图标,因此没有图标设置。

For more information about WebGL Publishing Settings, see WebGL Building and Running.
有关 WebGL 发布设置的更多信息,请参阅 WebGL 构建 和 运行。

Resolution and Presentation
分辨率和显示

Use the Resolution and Presentation section to customize the aspects of the screen’s appearance in the Resolution section.
使用“分辨率”部分中的“分辨率和显示”部分来自定义屏幕在“分辨率”部分中的外观。

Resolution section for the WebGL Player platform
Resolution section for the WebGL Player platform
WebGL Player 平台分辨率部分

Resolution  分辨率

Setting  设置 Function  功能
Default Canvas Width  默认画布宽度 Set the width of the WebGL canvas element.
设置 WebGL 画布元素的宽度。
Default Canvas Height  默认画布高度 Set the height of the WebGL canvas element.
设置 WebGL 画布元素的高度。
Run In Background  在后台运行 Enable this option to allow your content to continue to run when the canvas or the browser window loses focus.
启用此选项以允许您的内容在画布或浏览器窗口失去焦点时继续运行。

WebGL Template  WebGL 模板

Select a template to use for your WebGL Project:
选择一个模板用于您的 WebGL 项目:

  • The Default page is a simple white page with a loading bar on a grey canvas.
    默认页面是一个简单的白色页面,在灰色画布上有一个加载条。
  • The Minimal page has only the necessary boilerplate code to run the WebGL content.
    最小化页面只包含运行 WebGL 内容所必需的样板代码。
  • The PWA page has a Progressive Web AppA software application that’s delivered through the web. It uses certain browser features to create a user experience on par with a native application. More info
    通过网络提供的一种软件应用程序。它使用某些浏览器功能来创建与原生应用程序相媲美的用户体验。更多信息

    See in Glossary  查看术语表
    including a web manifest file and service worker code.
    PWA 页面包含一个 Progressive Web AppA software application that’s delivered through the web. It uses certain browser features to create a user experience on par with a native application. More info 
    See in Glossary  查看术语表
    ,包括一个网页清单文件和服务工作者代码。

You can specify your own template so that you can run your game in a similar environment to the finished game. Follow the instructions in Using WebGL Templates.
您可以指定自己的模板,以便在类似完成游戏的环境下运行您的游戏。请遵循《使用 WebGL 模板》中的说明。

Splash Image  启动画面图像

Use the Virtual Reality Splash Image setting to select a custom splash image for XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info
一个包括虚拟现实(VR)、增强现实(AR)和混合现实(MR)应用的统称。支持这些交互式应用形式的设备可以称为 XR 设备。更多信息

See in Glossary  查看术语表
displays. For information on common Splash Screen settings, see Splash Screen.
使用虚拟现实启动画面图像设置来为 XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info 
See in Glossary  查看术语表
显示选择自定义启动画面。有关常见启动屏幕设置的详细信息,请参阅启动屏幕。

Splash screen settings for virtual reality.
Splash screen settings for virtual reality.
虚拟现实启动画面设置。

Other Settings  其他设置

This section allows you to customize a range of options organized into the following groups:
本节允许您自定义一系列选项,这些选项组织成以下组:

Rendering  渲染

Use these settings to customize how Unity renders your game for the WebGL platform.
使用这些设置来自定义 Unity 如何为 WebGL 平台渲染您的游戏。

Property  属性 Description  描述
Color Space  颜色空间 Choose what color space to use for rendering: Gamma or Linear.
选择用于渲染的颜色空间:伽玛或线性。

Refer to Linear rendering overview for an explanation of the difference between the two.
参考线性渲染概述以了解两者之间的区别的解释。
MSAA Fallback  MSAA 回退 Select the multi sample antialiasingA technique for decreasing artifacts, like jagged lines (jaggies), in images to make them appear smoother.
一种减少图像中如锯齿线(jaggies)等伪影的技术,使图像看起来更平滑。

See in Glossary  查看术语表
fallback strategy to upgrade or downgrade the sample count if the sample count requested by the user isn’t supported by the device.
选择多样本 antialiasingA technique for decreasing artifacts, like jagged lines (jaggies), in images to make them appear smoother. 
See in Glossary  查看术语表
回退策略,以在用户请求的样本数不支持设备时升级或降级样本数。
Upgrade  升级 The sample count reduces to the nearest supported lower sample count.
样本计数减少到最近的受支持的低样本计数。
Downgrade  降级 The sample count increases to the next higher sample count. If that sample count is not supported, then it reduces to the nearest supported lower sample count.
样本计数增加到下一个更高的样本计数。如果该样本计数不受支持,则减少到最近的受支持的低样本计数。
Auto Graphics API  自动图形 API Disable this option to manually pick and reorder the graphics APIs. By default this option is enabled, and Unity includes WebGL2.0, with WebGL1.0 as a fallback for devices where WebGL2.0 isn’t supported.
禁用此选项以手动选择和重新排序图形 API。默认情况下此选项启用,Unity 包括 WebGL2.0,对于不支持 WebGL2.0 的设备,以 WebGL1.0 作为后备。
Static BatchingA technique Unity uses to draw GameObjects on the screen that combines static (non-moving) GameObjects into big Meshes, and renders them in a faster way. More info
Unity 使用的一种在屏幕上绘制 GameObject 的技术,它将静态(非移动)GameObject 组合成大 Mesh,并以更快的速度渲染。更多信息

See in Glossary  查看术语表
Enable this option to use Static batching.
启用此选项以使用静态批处理。
Dynamic BatchingAn automatic Unity process which attempts to render multiple meshes as if they were a single mesh for optimized graphics performance. The technique transforms all of the GameObject vertices on the CPU and groups many similar vertices together. More info
一个自动的 Unity 过程,尝试将多个 mesh 渲染成单个 mesh,以优化图形性能。该技术将所有 GameObject 顶点在 CPU 上转换,并将许多相似的顶点分组在一起。更多信息

See in Glossary  查看术语表
Enable this option to use Dynamic Batching on your build (enabled by default).
启用此选项以在您的构建中使用动态批处理(默认启用)。
Graphics Jobs  图形作业 Enable this option to instruct Unity to offload graphics tasks (render loops) to worker threads running on other CPU cores. Use it to reduce the time spent in Camera.Render on the main thread, which is often a bottleneck.
启用此选项以指示 Unity 将图形任务(渲染循环)卸载到运行在其他 CPU 核心上的工作线程。使用它来减少在主线程上花费的时间,这通常是瓶颈。

Note: This feature is experimental. It might not deliver a performance improvement for your project, and might introduce new crashes.
注意:此功能为实验性。它可能不会为您的项目带来性能提升,并可能引入新的崩溃。
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  查看术语表
format  纹理格式 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  查看术语表
Choose DXT, ETC2, or ASTC to set the texture compression3D Graphics hardware requires Textures to be compressed in specialized formats which are optimized for fast Texture sampling. More info
3D 图形硬件需要将纹理压缩到专门的格式中,这些格式针对快速纹理采样进行了优化。更多信息

See in Glossary  查看术语表
format for WebGL. For information on how to pick the right format, refer to Texture compression format overview and to learn how to create builds for desktop and mobile browsers from a script, refer to Texture Compression in WebGL.
选择 DXT、ETC2 或 ASTC 以设置 WebGL 的 texture compression3D Graphics hardware requires Textures to be compressed in specialized formats which are optimized for fast Texture sampling. More info
3D 图形硬件需要将纹理压缩到专门的格式中,这些格式针对快速纹理采样进行了优化。更多信息

See in Glossary  查看术语表
格式。有关如何选择正确格式的信息,请参阅纹理压缩格式概述,要了解如何从脚本中创建桌面和移动浏览器的构建,请参阅 WebGL 中的纹理压缩。
LightmapA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
一种预先渲染的纹理,其中包含场景中静态对象上光源的效果。光图叠加在场景几何形状上,以创建光照效果。更多信息

See in Glossary  查看术语表
Encoding  编码 LightmapA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
一种预先渲染的纹理,其中包含场景中静态对象上光源的效果。光图叠加在场景几何形状上,以创建光照效果。更多信息

See in Glossary  查看术语表
Choose Low Quality, Normal Quality, or High Quality to set the lightmap encoding. This setting affects the encoding scheme and compression format of the lightmaps. For more information, refer to Lightmaps: Technical information.
选择低质量、普通质量或高质量以设置光照贴图的编码。此设置影响光照贴图的编码方案和压缩格式。有关更多信息,请参阅光照贴图:技术信息。
HDRhigh dynamic range  高动态范围
See in Glossary  查看术语表
CubemapA collection of six square textures that can represent the reflections in an environment or the skybox drawn behind your geometry. The six squares form the faces of an imaginary cube that surrounds an object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back). More info
一组六个正方形纹理,可以表示环境中的反射或绘制在您的几何形状后面的天空盒。这六个正方形形成一个围绕对象的想象中的立方体的面;每个面代表沿世界轴(向上、向下、向左、向右、向前和向后)的方向的视图。更多信息

See in Glossary  查看术语表
Encoding  编码 HDRhigh dynamic range  高动态范围
See in Glossary  查看术语表
CubemapA collection of six square textures that can represent the reflections in an environment or the skybox drawn behind your geometry. The six squares form the faces of an imaginary cube that surrounds an object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back). More info
一组六个正方形纹理,可以表示环境中的反射或绘制在您的几何形状后面的天空盒。这六个正方形形成一个围绕对象的想象中的立方体的面;每个面代表沿世界轴(向上、向下、向左、向右、向前和向后)的方向的视图。更多信息

See in Glossary  查看术语表
Choose Low Quality, Normal Quality, or High Quality to set the HDR Cubemap encoding. This setting affects the encoding scheme and compression format of the HDR Cubemaps.
选择低质量、普通质量或高质量以设置 HDR 立方体贴图的编码。此设置影响 HDR 立方体贴图的编码方案和压缩格式。
Lightmap Streaming Enabled
光照贴图流式传输已启用
Whether to use Mipmap Streaming for lightmaps. Unity applies this setting to all lightmaps when it generates them.
是否使用 Mipmap 流式传输进行光照贴图。Unity 在生成光照贴图时将应用此设置到所有光照贴图。

Note: To use this setting, you must enable the Texture Streaming Quality setting.
注意:要使用此设置,您必须启用纹理流式传输质量设置。
Streaming Priority  流式传输优先级 Set the priority for all lightmaps in the Mipmap Streaming system. Unity applies this setting to all lightmaps when it generates them.
在 Mipmap Streaming 系统中设置所有光照贴图的优先级。Unity 在生成光照贴图时将此设置应用于所有光照贴图。

Positive numbers give higher priority. Valid values range from —128 to 127.
正数表示更高的优先级。有效值范围从-128 到 127。
Frame Timing Stats  帧时间统计 Enable this option to gather CPU/GPU frame timing statistics.
启用此选项以收集 CPU/GPU 帧时间统计信息。
Virtual Texturing (Experimental)
虚拟纹理(实验性)
Indicates whether to enable Virtual Texturing.
指示是否启用虚拟纹理。

Note: The Unity Editor requires a restart for this setting to take effect.
注意:Unity 编辑器需要重新启动才能使此设置生效。
360 Stereo Capture  360 立体捕获 Indicates whether Unity can capture stereoscopic 360 images and videos. When enabled, Unity compiles additional shaderA program that runs on the GPU. More info
在 GPU 上运行的程序。更多信息

See in Glossary  查看术语表
variants to support 360 capture (currently only on Windows/OSX). When enabled, the enable_360_capture_ keyword is added during the Stereo RenderCubemap call. Note that this keyword is not triggered outside the Stereo RenderCubemap function.
指示 Unity 是否可以捕获立体 360 图像和视频。启用时,Unity 会编译额外的 shaderA program that runs on the GPU. More info
在 GPU 上运行的程序。更多信息

See in Glossary  查看术语表
变体以支持 360 捕获(目前仅在 Windows/OSX 上)。启用时,在 Stereo RenderCubemap 调用期间会添加 enable_360_capture_ 关键字。请注意,此关键字在 Stereo RenderCubemap 函数外部不会触发。
Load/Store Action Debug Mode
加载/存储操作调试模式
Highlights undefined pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
计算机图像中最小的单位。像素大小取决于您的屏幕分辨率。每个屏幕像素都会计算像素照明。更多信息

See in Glossary  查看术语表
that might cause rendering problems in your built application. The highlighting appears only in the Game view, and your built application if you select Development BuildA development build includes debug symbols and enables the Profiler. More info
开发版本包含调试符号并启用分析器。更多信息

See in Glossary  查看术语表
in Build Settings. Refer to LoadStoreActionDebugModeSettings.
突出显示可能引起您构建的应用程序渲染问题的未定义 pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
计算机图像中最小的单位。像素大小取决于您的屏幕分辨率。每个屏幕像素都会计算像素照明。更多信息

See in Glossary  查看术语表
。突出显示仅在游戏视图中出现,如果您在构建设置中选择 Development BuildA development build includes debug symbols and enables the Profiler. More info
开发版本包含调试符号并启用分析器。更多信息

See in Glossary  查看术语表
,则也会出现在您的构建应用程序中。请参阅 LoadStoreActionDebugModeSettings。
Editor Only  仅编辑器 Highlights undefined pixels in the Game view in the Editor, but not your built application.
在编辑器中突出显示游戏视图中未定义的像素,但不在您的构建应用程序中。


Note: This option is visible only when Load/Store Action Debug Mode is active.
注意:此选项仅在加载/存储操作调试模式激活时可见。

Configuration  配置

Configuration settings for the WebGL platform
Configuration settings for the WebGL platform
WebGL 平台配置设置
Property  属性 Description  描述
Scripting Backend  脚本后端 Choose the scripting backend you want to use. The scripting backend determines how Unity compiles and executes C# code in your Project.
选择您想要使用的脚本后端。脚本后端决定了 Unity 如何编译和执行项目中 C#代码。有关更多信息,请参阅{{0}} 。
Mono Compiles C# code into .NET Common Intermediate Language (CIL) and executes that CIL using a Common Language Runtime. For more information, refer to MonoA scripting backend used in Unity. More info
Unity 中使用的脚本后端。更多信息

See in Glossary  查看术语表
.
将 C#代码编译成.NET 公共中间语言(CIL),并使用公共语言运行时执行该 CIL。有关更多信息,请参阅 MonoA scripting backend used in Unity. More info
Unity 中使用的脚本后端。更多信息

See in Glossary  查看术语表
IL2CPP Compiles C# code into CIL, converts the CIL to C++ and then compiles that C++ into native machine code, which executes directly at runtime. For more information, refer to IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info
这是一个 Unity 开发的脚本后端,您可以在构建某些平台的项目时将其用作 Mono 的替代品。更多信息

See in Glossary  查看术语表
.
将 C#代码编译成 CIL,然后将 CIL 转换为 C++,最后将 C++编译成本地机器码,该机器码在运行时直接执行。有关更多信息,请参阅 IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info
这是一个 Unity 开发的脚本后端,您可以在构建某些平台的项目时将其用作 Mono 的替代品。更多信息

See in Glossary  查看术语表
API Compatibility Level  API 兼容级别 Choose which .NET APIs you can use in your project. This setting can affect compatibility with third-party libraries. However, it has no effect on Editor-specific code (code in an Editor directory, or within an Editor-specific Assembly Definition).
选择您可以在项目中使用的.NET API。此设置可能会影响与第三方库的兼容性。然而,它对编辑器特定代码(位于编辑器目录中的代码或位于编辑器特定程序集定义中的代码)没有影响。


Tip: If you are having problems with a third-party assembly, you can try the suggestion in the API Compatibility Level section below.
提示:如果您在使用第三方程序集时遇到问题,可以尝试以下 API 兼容级别部分中的建议。
.Net Framework  .NET 框架 Compatible with the .NET Framework 4 (which includes everything in the .NET Standard 2.0 profile plus additional APIs). Choose this option when using libraries that access APIs not included in .NET Standard 2.0. Produces larger builds and any additional APIs available aren’t necessarily supported on all platforms. Refer to Referencing additional class library assemblies for more information.
兼容 .NET Framework 4(包括 .NET Standard 2.0 配置文件中的所有内容以及额外的 API)。当使用访问不在 .NET Standard 2.0 中包含的 API 的库时,请选择此选项。生成的构建较大,并且并非所有平台都支持可用的额外 API。有关更多信息,请参阅“引用额外的类库程序集”。
.Net Standard 2.1 Produces smaller builds and has full cross-platform support.
生成的构建较小,并且具有完全的跨平台支持。
IL2CPP Code Generation  IL2CPP 代码生成 Defines how Unity manages IL2CPP code generation.
定义了 Unity 如何管理 IL2CPP 代码生成。
Faster runtime  更快的运行时 Generates code optimized for runtime performance. This setting is enabled by default.
生成针对运行时性能优化的代码。此设置默认启用。
Faster (smaller) builds  更快的(更小的)构建 Generates code optimized for build size and iteration. This setting generates less code and produces a smaller build, but may reduce runtime performance, especially for generic code. Use this option when faster build times are important, such as when iterating on changes.
生成针对构建大小和迭代优化的代码。此设置生成的代码更少,构建更小,但可能会降低运行时性能,尤其是在通用代码中。当更快的构建时间很重要时,例如在迭代更改时,请使用此选项。
C++ Compiler Configuration
C++ 编译器配置
Chooses the C++ compiler configuration used when compiling IL2CPP generated code.
选择编译 IL2CPP 生成的代码时使用的 C++ 编译器配置。


Note: This property is disabled for the Universal Windows Platform because it’s chosen in the generated Visual Studio project.
注意:由于在生成的 Visual Studio 项目中已选择,因此此属性在通用 Windows 平台上已禁用。
Use incremental GC  使用增量 GC Uses the incremental garbage collector, which spreads garbage collection over several frames to reduce garbage collection-related spikes in frame duration. For more information, refer to Automatic Memory Management.
使用增量垃圾回收器,它将垃圾回收分散到几个帧中,以减少帧持续时间中的垃圾回收相关峰值。有关更多信息,请参阅自动内存管理。
Allow downloads over HTTP
允许通过 HTTP 下载
Indicates whether to allow downloading content over HTTP. The default option is Not allowed due to the recommended protocol being HTTPS, which is more secure.
指示是否允许通过 HTTP 下载内容。默认选项为不允许,因为推荐协议为 HTTPS,它更安全。
Not Allowed  不允许 Never allow downloads over HTTP.
永远不允许通过 HTTP 下载。
Allowed in Development Builds
开发构建中允许
Only allow downloads over HTTP in development builds.
仅允许在开发构建中通过 HTTP 下载。
Always Allowed  始终允许 Allow downloads over HTTP in development and release builds.
允许在开发和发布构建中通过 HTTP 下载。
Active Input Handling  活动输入处理 Choose how to handle input from users.
选择如何处理用户输入。
Input Manager (Old)  输入管理器(旧版) Uses the traditional Input settings.
使用传统的输入设置。
Input System Package (New)
输入系统包(新)
Uses the Input system. This option requires you to install the InputSystem package.
使用输入系统。此选项需要您安装 InputSystem 包。
Both  两者 Use both systems.  使用两个系统。

Shader Variant Loading  着色器变体加载

Use these settings to control how much memory shaders use at runtime.
使用这些设置来控制着色器在运行时使用的内存量。

Property  属性 Description  描述
Default chunk size (MB)  默认块大小(MB) Sets the maximum size of compressed shader variant data chunks Unity stores in your built application for all platforms. The default is 16. For more information, refer to Shader loading.
设置 Unity 在您的应用程序中为所有平台存储压缩着色器变体数据块的最大大小。默认值为 16 。有关更多信息,请参阅着色器加载。
Default chunk count  默认块数量 Sets the default limit on how many decompressed chunks Unity keeps in memory on all platforms. The default is 0, which means there’s no limit.
设置 Unity 在所有平台上保留在内存中的解压缩块数量的默认限制。默认值为 0 ,这意味着没有限制。
Override  覆盖 Enables overriding Default chunk size and Default chunk count for this build target.
启用覆盖此构建目标的默认块大小和默认块计数。
Chunk size (MB)  块大小(MB) Overrides the value of Default chunk size (MB) on this build target.
覆盖此构建目标上默认块大小(MB)的值。
Chunk count  块计数 Overrides the value of Default chunk count on this build target.
覆盖此构建目标上的默认块计数值。

API Compatibility Level

You can choose your mono API compatibility level for all targets. Sometimes a third-party .NET library uses functionality that’s outside of your .NET compatibility level. To understand what is going on in such cases, and how to best fix it, try following these suggestions:

  1. Install ILSpy for Windows.
  2. Drag the .NET assemblies for the API compatibility level that you’re having issues with into ILSpy. You can find the problematic files under Frameworks/Mono/lib/mono/YOURSUBSET/.
  3. Drag in your third-party assembly.
  4. Right-click your third-party assembly and select Analyze.
  5. In the analysis report, inspect the Depends on section. The report highlights anything that the third-party assembly depends on, but that’s not available in the .NET compatibility level of your choice in red.

Script Compilation

Script compilation settings for the WebGL platform
Script compilation settings for the WebGL platform
Property Description
Scripting Define Symbols Sets custom compilation flags.

For more details, see Platform dependent compilation.
Additional Compiler Arguments Adds entries to this list to pass additional arguments to the Roslyn compiler. Use one new entry for each additional argument.
To create a new entry, click Add (+). To remove an entry, click Remove (-).

When you have added all desired arguments, click Apply to include your additional arguments in future compilations. Click Revert to reset this list to the most recent applied state.
Suppress Common Warnings Indicates whether to display the C# warnings CS0169 and CS0649.
Allow ‘unsafe’ Code Enables support for compiling ‘unsafe’ C# code in a pre-defined assembly (for example, Assembly-CSharp.dll).
For Assembly Definition Files (.asmdef), click on one of your .asmdef files and enable the option in the Inspector window that appears.
Use Deterministic Compilation Indicates whether to prevent compilation with the -deterministic C# flag. With this setting enabled, compiled assemblies are byte-for-byte identical each time they are compiled.

For more information, see Microsoft’s deterministic compiler option.

Optimization

Optimization settings for the WebGL platform
Optimization settings for the WebGL platform
Property Description
Prebake Collision Meshes Adds collision data to Meshes at build time.
Keep Loaded Shaders Alive Indicates whether to prevent shaders from being unloaded.

For more information, see Shader Loading.
Preloaded Assets Sets an array of Assets for the player to load on startup.
To add new Assets, increase the value of the Size property and then set a reference to the Asset to load in the new Element box that appears.
Strip Engine Code Enable this option if you want the Unity Linker tool to remove code for Unity Engine features that your Project doesn’t use. This setting is only available with the IL2CPP scripting backend. Most apps do not use every available DLL. This option strips out DLLs that your app doesn’t use to reduce the size of the built Player. If your app is using one or more classes that would normally be stripped out under your current settings, Unity displays a debug message when you try to build the app.
Managed Stripping Level Chooses how aggressively Unity strips unused managed (C#) code. The options are Minimal, Low, Medium, and High.
When Unity builds your app, the Unity Linker process can strip unused code from the managed DLLs your Project uses. Stripping code can make the resulting executable significantly smaller, but can sometimes accidentally remove code that’s in use.

For more information about these options and bytecode stripping with IL2CPP, refer to ManagedStrippingLevel.
Vertex Compression Sets vertex compression per channel. This affects all the meshes in your project.
Typically, Vertex Compression is used to reduce the size of mesh data in memory, reduce file size, and improve GPU performance.

For more information on how to configure vertex compression and limitations of this setting, refe to Compressing mesh data.
Optimize Mesh Data Enable this option to strip unused vertex attributes from the mesh used in a build. This option reduces the amount of data in the mesh, which can help reduce build size, loading times, and runtime memory usage.

Warning: If you have this setting enabled, you should remember to not change material or shader settings at runtime.

For more information, refer to PlayerSettings.stripUnusedMeshComponents.
Texture MipMap Stripping Enables mipmap stripping for all platforms. This strips unused mipmaps from Textures at build time. Unity determines unused mipmaps by comparing the value of the mipmap against the Quality Settings for the current platform. If a mipmap value is excluded from every Quality Setting for the current platform, then Unity strips those mipmaps from the build at build time. If QualitySettings.masterTextureLimit is set to a mipmap value that has been stripped, Unity will set the value to the closest mipmap value that has not been stripped.

Stack Trace

Select the logging settings for the WebGL platform.

Logging settings for the WebGL platform
Logging settings for the WebGL platform

Select your preferred stack trace method by enabling the option that corresponds to each Log Type (Error, Assert, Warning, Log, and Exception) based on the type of logging you require. For more information, refer to stack trace logging.

Property Description
None No logs are ever recorded.
ScriptOnly Logs only when running 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
.
Full Logs all the time.

Legacy

Enable the Clamp BlendShapes (Deprecated) option to clamp the range of blend shape weights in Skinned Mesh Renderers.

Legacy settings for the WebGL platform
Legacy settings for the WebGL platform

Publishing settings

Use the Publishing Settings to configure how Unity builds your WebGL app. For example, you can choose to enable the browser cache to store its files in your build.

Publishing settings for the WebGL platform
Publishing settings for the WebGL platform
Setting Function
Enable Exceptions Choose how to handle unexpected code behavior (generally considered errors) at run time. The options are: None, Explicitly Thrown Exceptions Only, Full Without Stacktrace, and Full With Stacktrace. See the Building and running a WebGL project page for details.
Compression Format Choose the compression format to use for release build files. The options are: Gzip, Brotli, or Disabled (none). Note that this option doesn’t affect development builds.
Name Files As Hashes Enable this option to use an MD5 hash of the uncompressed file contents as a filename for each file in the build.
Data caching Enable this option to automatically cache your contents Asset data on the user’s machine so it doesn’t have to be re-downloaded on subsequent runs (unless the contents have changed).
Caching is implemented using the IndexedDB API provided by the browser. Some browsers might implement restrictions around this, such as asking the user for permission to cache data over a specific size.
Debug Symbols Select from the available options to specify how debug symbols are added in your build.
Off Select this option if you don’t want any debug symbols to be added in your build.
External Select this option to store the debug symbols to in a separate file that you can download from the server when an error occurs. It’s recommended to choose this option for release builds.
Embedded Select this option to embed the debug symbols in a WASM file. This option helps preserve debug symbols and perform demangling (displaying the original function names) of the stack trace when an error occurs. By default, demangling support is available for this option.
Show Diagnostic Overlay Enable this option to display an overlay of diagnostics information in Web platform builds when users click the Diagnostics icon on the WebGL canvas. It’s available for both Development and Release builds.
Decompression Fallback Include decompression fallback code for build files in the loader. Use this option if you are unable to configure server response headers according to the selected compression method.
Initial Memory Size The initial size of the WASM heap memory in megabytes (MB). By default, this is set to 32 MB. If Memory Growth Mode is set to None, then this is also the maximum size of WASM heap memory.
Memory Growth Mode Choose the growth mode for the WASM heap memory from the following options. The recommended option is Geometric.
None The WASM heap memory has a fixed size configured in Initial Memory Size.
Linear The WASM heap memory increases by a fixed amount configured by Linear Memory Growth Step.
Geometric The WASM heap memory increases relative to the current heap size depending on the factor configured in Geometric Memory Growth Step and Geometric Memory Growth Cap.
Power Preference Set a preference for which GPU to use when rendering on a multi-GPU device. Note that the browser might ignore this preference.
Default Let the browser choose the GPU configuration.
Low Performance Request that the browser use the integrated GPU to prioritize power savings.
High Performance Request that the browser use the external GPU to prioritize rendering performance.
Maximum Memory Size The maximum size of the WASM heap memory in MB. By default, this is set to 2048 MB. This option is only available for the Memory Growth Mode Linear or Geometric.
Linear Memory Growth Step Advanced tuning option to control the WASM heap growth step in MB. By default, this is set to 16 MB. A growth step of 16 MB indicates that the heap is increased by 16 MB each time it needs to grow. Only available if Memory Growth Mode is set to Linear.
Geometric Memory Growth Step Advanced tuning option to control the WASM heap growth factor relative to the current heap size. By default, this is set to 0.2. A growth factor of 0.2 means that the size of the heap is increased by 0.2 * currentHeapSize each time the heap needs to grow. Only available if Memory Growth Mode is set to Geometric.
Geometric Memory Growth Cap Advanced tuning option to control the upper limit for a heap growth step in MB. By default, this is set to 96 MB. A growth cap of 96 MB means that the size of the heap is increased by at most 96 MB. Only available if Memory Growth Mode is set to Geometric.

Show Diagnostic Overlay setting

To help optimize WebGL builds and diagnose potential problems, you can view diagnostics information (currently limited to memory usage) by enabling this setting. Once enabled, an icon appears on the build that displays an overlay with useful data about the build. It’s available for both Development and Release builds.

  1. To view the diagnostics information, enable the Show Diagnostics Overlay option in the Player settings window (File > Build Settings > Player Settings > Publishing Settings).

    On desktop, the Diagnostics icon appears on the footer of the WebGL canvas:

    Diagnostics button on the footer of the canvas
    Diagnostics button on the footer of the canvas

    On a mobile device, the Diagnostics icon appears on the bottom-right of the screen:

    An Android phone displaying the diagnostics button
    An Android phone displaying the diagnostics button
  2. Click the Diagnostics icon. An overlay appears showing the JavaScript memory, which is further broken down to display WASM heap memory usage:

The Diagnostics overlay shows the JavaScript memory distribution and the WASM heap memory usage
The Diagnostics overlay shows the JavaScript memory distribution and the WASM heap memory usage

The following diagnostics appear on the overlay screen:

Property Function
Total JS Memory The current size of the JavaScript (JS) heap, including unused memory not allocated to any JS objects in megabytes.
Used JS Memory Memory in use by JS objects in megabytes.
Total WASM heap memory Linear memory representing the entire heap of the C/C++ Unity engine that’s compiled with Emscripten, including unallocated memory in megabytes.
Used WASM heap The space of the WASM heap that’s allocated in megabytes.

Important note about JS Memory

The JS Memory information is obtained using the performance.memory API, which is currently only supported on Chrome or Edge. There are no other APIs available that return this information for Safari or Firefox.

Note: The performance.memory API isn’t supported on iOS devices.

On browsers where this API isn’t supported, a message showing N/A appears.

A N/A message appears on browsers that dont support performance.memory API
A N/A message appears on browsers that don’t support performance.memory API

Additional resources:

PlayerSettingsWebGL


Did you find this page useful? Please give it a rating:

WebGL development
Interaction with browser scripting