Version: 2021.3
Interaction with browser scripting
WebGL 빌드 디버깅 및 문제 해결

WebGL performance considerations

In general, the WebGL performance is close to native apps on the GPU, because the WebGL graphics API uses your GPU for hardware-accelerated rendering. The only exception is the slight overhead for translating WebGL API calls and shaders to your OS graphics API (typically DirectX on Windows, OpenGL on Mac, and Linux).

On the CPU, Emscripten translates your code into WebAssembly, the performance of which depends on the web browser you’re using. For more information, see the Unity blog post WebAssembly Load Times and Performance.

Following are the additional considerations that you must 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 than other code. * You cannot write threading or SIMD code in WebGL in your scripts, but as some engine parts are multi-threaded or SIMD optimized, they offer low performance on WebGL. For example, WebGL Skinning is both multi-threaded and SIMD-optimized.

Tip: To see how Unity distributes work to different threads on non-WebGL platforms, see the new timeline Profiler in Unity.

WebGL-specific settings which affect performance

For best performance, set the optimization level to Faster in the Build Player window, and set Exception support to None in the Player settings for WebGL by expanding Other Settings > Stack Trace.

Profiling WebGL

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

WebGL content in background tabs

WebGL 플랫폼용 플레이어 설정에서 Run in background를 활성화하거나 Application.runInBackground을 활성화하면 포커스가 캔버스 또는 브라우저 창에서 벗어나도 콘텐츠가 계속 실행됩니다.

하지만 일부 브라우저는 배경 탭에서 실행 중인 콘텐츠의 속도를 늦출 수 있습니다. 콘텐츠가 있는 탭이 보이지 않으면 대부분의 브라우저에서는 콘텐츠가 1초에 한 번씩만 업데이트됩니다. 이로 인해 Time.maximumDeltaTime의 기본값이 1초보다 작으므로 기본 설정을 사용하면 Time.time이 일반적인 경우보다 더 느리게 진행됩니다.

WebGL 성능 속도 저하

You might want to run your WebGL content at a lower frame rate in some situations to reduce CPU usage. For example, 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 than 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 페이지 수정됨
Interaction with browser scripting
WebGL 빌드 디버깅 및 문제 해결