Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AdaptivePerformanceStableFrameModeProvider

Mode provider that prioritizes consistent frame time over the highest achievable frame rate.
Read time 2 minutesLast updated 8 days ago

Definition

public class AdaptivePerformanceStableFrameModeProvider : IAdaptivePerformanceModeProvider

Remarks

On mode start the provider reads the AdaptiveFramerate scaler's bounds and pins Time.maximumDeltaTime to
1 / MinBound
— a physics-stability clamp so a hitch can never stretch a single physics step past the budget.
The provider then forces vsync off (QualitySettings.vSyncCount to 0) and takes ownership of framerate: vsync's snap-to-refresh-divisor behavior turns a missed deadline into a large frame-time spike, exactly the variance this mode fights. It force-enables the AdaptiveFramerate scaler, starts Application.targetFrameRate at MaxBound, and lets the scaler participate in the indexer's cost-based adjustment so the framerate seeks the highest stably-reachable rate (MinBound is the floor). The original vsync count, framerate, and maximum delta time are all restored on mode end.
Each frame it produces a performance action and adopts whichever signal asks for the most aggressive change. A headroom guard runs on every frame regardless of vsync: it asks for a decrease when CPU/GPU work climbs toward the presented frame interval, which is one load bump from a dropped frame. Alongside it a variance signal runs, whose source depends on whether presentation is vsync-locked. When it is (mobile always is — its compositor paces frames at the hardware level regardless of QualitySettings.vSyncCount), wall-clock frame time quantizes to the display cadence and its variance goes blind until a frame drops, so the provider measures variance on CPU/GPU work time. When it isn't, wall-clock frame time is authoritative and its variance is measured directly. Both paths also honor the MinBound floor via AdaptivePerformanceStableFrameModeProvider.TargetFrameTimeVarianceMs's companion lower-bound check.

Properties

Property

Description

CpuUtilizationActionThe action the mode applies in response to the device's CPU utilization data. Always StateAction.Stale because this mode drives scalers from frame-time variance rather than CPU utilization.
GpuUtilizationActionThe action the mode applies in response to the device's GPU utilization data. Always StateAction.Stale because this mode drives scalers from frame-time variance rather than GPU utilization.
IndexerThe Indexer that this mode adjusts scalers through.
ModeNameThe name of the operation mode.
PerformanceActionThe action the mode applies in response to the device's performance state.
SettingsThe active Adaptive Performance settings.
TargetFrameTimeVarianceMsMaximum tolerated variance in the mode's frame-cost signal, in ms².
ThermalActionThe action the mode applies in response to the device's thermal state.

Methods

Method

Description

ApplyModeActionsApplies stable frame mode's variance, lower-bound, and headroom actions to the active scalers. Adaptive Performance calls this method every frame while stable frame mode is active.
OnOperationModeEndCalled when stable frame mode is replaced by another operation mode. Resets the variance window and restores the framerate bounds it applied.
OnOperationModeStartCalled when stable frame mode becomes the active operation mode. Resets the variance window and applies the framerate bounds read from the AdaptiveFramerate scaler.