Version: 2021.1
Using audio in WebGL
Getting started with WebGL development

Embedded Resources on WebGL

.NET assemblies can contain embedded resources. An embedded resource is a collection of binary data that is part of the .NET assembly. You can access this binary data in code via a file-like API.

By default, 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
builds don’t include embedded resources. This helps to keep the size of the final binary lower, because embedded resources can be rather large. However, some user code and .NET class library APIs depend on the presence of embedded resources to work properly. For example, string comparisons that use the StringComparison.InvariantCultureIgnoreCase value use embedded resources when comparing non-ASCII characters.

You can use the following Editor script to enable embedded resources for a WebGL build:

using UnityEditor;

public class WebGLEditorScript
{
    [MenuItem("WebGL/Enable Embedded Resources")]
    public static void EnableErrorMessageTesting()
    {
        PlayerSettings.SetPropertyBool("useEmbeddedResources", true, BuildTargetGroup.WebGL);
    }
}

When this Player setting is enabled, the WebGL build includes any embedded resources in any .NET assemblies the Project uses.


  • 2019–06–12 Page published
Using audio in WebGL
Getting started with WebGL development
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961