3D WebView's default 3D rendering mode works by rendering web content to a texture that is shown in Unity. This approach works efficiently in most cases, but there are some scenarios where it is slower:
On iOS, visionOS, and Universal Windows Platform (UWP), the platforms' native APIs for capturing pixels from the browser are relatively slow, so the web frame rate is noticeably slower on those platforms when using the default 3D rendering mode.
On Windows and macOS, if a webview is large and uses a PixelDensity greater than 1, the browser performance can degrade.
Tips for improving performance
On Android, iOS, and UWP, use Native 2D Mode if possible. Or in the case of visionOS, use VisionOSWebView.CreateInWindow(). These options directly display the native webview widget (rather than rendering to a texture), which provides the best possible performance.
On Windows and macOS, performance may be improved by passing the following command line arguments. However, this will also disable the browser's support for WebGL.
void Awake() { StandaloneWebView.SetCommandLineArguments("--disable-gpu --disable-gpu-compositing"); }
Reduce the webview's size, Resolution, or PixelDensity.
If you control the web page loaded in the webview, consider reducing the page's complexity.
If your app uses multiple webviews:
- Consider reducing the number of webviews.
- You can pause unused webviews by calling IWebView.SetRenderingEnabled(false).
- If some webviews are being used to show static content that doesn't change, you can call IWebView.CaptureScreenshot() to get a static image to display on a Quad so that you can destroy the webview.