Loading lessons...
Dynamic Resolution
Dynamic Resolution
Dynamic resolution dynamically scales the primary render targets to reduce GPU load and maintain stable target frame rates.
How It Works
Instead of modifying the viewport display window size:
- Unity renders target buffers to a smaller fraction of screenspace.
- The scaled render target is upscaled back to match the native display resolution before post-processing.
Enabling Dynamic Resolution
- Open your URP or HDRP Render Pipeline Asset.
- Enable the Dynamic Resolution checkbox.
- On the Camera component inspector, check Allow Dynamic Resolution.
Controlling Scale with Scripts
To set the scale at runtime, call the ScalableBufferManager API:
using UnityEngine;
public class PerformanceManager : MonoBehaviour
{
void Update()
{
if (GetPerformanceLoad() > 0.9f)
{
// Reduce render size to 70% in width and height
ScalableBufferManager.ResizeBuffers(0.7f, 0.7f);
}
else
{
// Reset to native scale
ScalableBufferManager.ResizeBuffers(1.0f, 1.0f);
}
}
private float GetPerformanceLoad() => 0.95f; // Mock implementation
}
Using FrameTimingManager
Combine dynamic resolution with the FrameTimingManager class to scale rendering according to measured GPU frame times:
// Captures timing data from the GPU rendering cycle
FrameTimingManager.CaptureFrameTimings();
TL;DR
- Enable Dynamic Resolution to adjust rendering load dynamically.
- Use
ScalableBufferManager.ResizeBuffers()to set resolution scale. - Integrates with
FrameTimingManagerto calculate performance scale targets.