Introduction
Web Adaptive Performance (WebAP) is a tool for the dynamic optimization of Unity WebGL applications.
It helps strike the perfect balance between visual quality and stable FPS across different devices: from powerful PCs to weak smartphones. Instead of rigid limits, the plugin analyzes frame timings in real-time. It detects the root cause of performance drops, smoothly reduces the load until stabilization is achieved, and restores quality when Performance Headroom becomes available.
Device Adaptation
Set your Unity project to maximum quality settings by default. The plugin will automatically scale them down at runtime if the current device cannot handle the load.
Why WebAP?
Why not the official Adaptive Performance package?
The official Unity package is a powerful tool, but it is fundamentally incompatible with WebGL. It relies on two types of providers, and both hit browser limitations:
- Native Providers (Android): Rely on system APIs to retrieve thermal status (Thermal Headroom) and manage frequencies. The browser sandbox blocks any hardware access, making this approach impossible. Emerging web standards (like the Compute Pressure API) only monitor the CPU and fail to provide precise data for 3D graphics.
- Basic Provider: Unity's cross-platform mathematical provider. It relies on
FrameTimingManager. However, for it to function, the engine requires high-precision hardware GPU timers, which are forcibly blocked or heavily obfuscated in browsers for security reasons (protection against Spectre/Meltdown attacks). Consequently, the official Basic Provider physically fails to initialize in WebGL.
The WebAP Solution: We have engineered an architecture tailored exclusively for the specifics of the web. WebAP also utilizes FrameTimingManager, but instead of a strict dependency on blocked GPU timers, the plugin employs secure heuristic analysis. It bypasses browser anomalies (such as metric distortion caused by setTimeout in Emscripten) and uses pure mathematics to calculate bottlenecks (CPU vs GPU). This provides an AAA-level optimization system that operates legally and stably in any browser.
Why not standard scaling scripts?
Classic solutions simply reduce screen resolution during any lag. This is useless if the application stutters due to CPU calculations (physics, scripts, logic) rather than rendering.
How WebAP Works:
- Bottleneck Detection
The plugin mathematically determines what limits the frame: CPU or GPU. If physics lags, the system simplifies physics without reducing screen resolution. Over 12 independent Scalers (Shadows, LOD, Layer Culling, etc.) are provided for this purpose. - Anti Yo-Yo Penalty System
Solves the frequent issue of dynamic resolution where Quality flickering occurs. If improving graphics immediately causes an FPS drop, the system temporarily enforces a Penalty Lockout to block further increases. - Preserving UI Clarity
If you choose the scaling mode viaRenderTexture, the resolution of the 3D world decreases, but the interface remains in the Native Browser Scaling resolution. A customWebScaledPhysicsRaycastercomponent automatically recalculates ray coordinates so that clicks on 3D objects function correctly regardless of frame compression. - Zero-GC Architecture
The entire project is designed with strict memory economy. The core uses O(1) ring buffers and performs zero allocations in theUpdateloop. Therefore, the plugin does not trigger the Garbage Collector (GC). - Zero Build Bloat
Many assets bloat the release build by placing their prefabs and textures in theResourcesfolder (forcing the engine to include them in the build). WebAP's architecture avoids this error. All tooling and the Dashboard UI are automatically stripped during compilation unless explicitly added to a scene. Only the lightweight core enters the final project. - Plug-and-Play Integration
Settings are consolidated in a unified interface within Project Settings. The plugin automatically injects into the build — you do not need to manually place manager prefabs on scenes.
Compatibility
- Unity Version:
2020.3 LTSand higher. The plugin utilizes modern APIs and automatically adopts new engine features (e.g.,Mesh LOD Thresholdsupport for Unity 6000.2+). - Render Pipelines: Seamless support for both Built-in Render Pipeline (BiRP) and Universal Render Pipeline (URP).
