Version: 2019.2
WebGL でオーディオの使用
Embedded Resources on WebGL

WebGL のパフォーマンスについて

WebGL のパフォーマンスと聞いてどの分野のパフォーマンスを想像しましたか?

In general, you should get performance close to native apps on the GPU, because the WebGL graphics API uses your GPU for hardware-accelerated rendering. There is a small amount of overhead for translating WebGL API calls and shaders to your OS graphics API (typically DirectX on Windows or OpenGL on Mac or Linux).

On the CPU, Emscripten translates your code into WebAssembly, so performance depends on the web browser. For more information, see the Unity blog post WebAssembly Load Times and Performance.

There are some other considerations you need to be aware of. The JavaScript language does not support multi-threading or SIMD. Any code that benefits from these features are likely to be slower then other code. You cannot write threading or SIMD code in WebGL in your scripts, but some engine parts are normally multi-threaded or SIMD optimized, and therefore with lower performance on WebGL. An example is the skinning code, which is both multi-threaded and SIMD-optimized.

You can use the new timeline Profiler in Unity to see how Unity distributes work to different threads on non-WebGL platforms.

パフォーマンスに影響する WebGL の設定

最高のパフォーマンスを得るには、Build Player ダイアログで最適化レベルを Fastest に設定し、WebGL の Player 設定で Exception supportNone に設定します。

WebGL のプロファイリング

WebGL supports the Unity profiler. See documentation on the Profiler to learn how to set it up.

バックグラウンドタブでの WebGL コンテンツ

Run in backgroundWebGL プラットフォームのプレイヤー設定 で有効になっている場合、または Application.runInBackground を有効にする場合、キャンバスやブラウザーウィンドウがフォーカスを失っても、コンテンツは引き続き実行されます。

However, some browsers can throttle content running in background tabs. If the tab with your content is not visible, your content only updates once per second in most browsers. Note that this causes Time.time to progress slower than usual with the default settings, as the default value of Time.maximumDeltaTime is lower than one second.

WebGL パフォーマンスの減速

You might want to run your WebGL content at a lower frame rate in some situations to reduce CPU usage. Like on other platforms, you can use the Application.targetFrameRate API to do so.

When you don’t want to throttle performance, set this API to the default value of –1, rather then to a high value. This allows the browser to adjust the frame rate for the smoothest animation in the browser’s render loop, and might produce better results than Unity trying to do its own main loop timing to match a target frame rate.


  • 2019–06–10 Page amended
WebGL でオーディオの使用
Embedded Resources on WebGL
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961