Class DynamicResolutionHandler
The class responsible to handle dynamic resolution.
Namespace: UnityEngine.Rendering
Syntax
public class DynamicResolutionHandler
Properties
filter
The filter that is used to upscale the rendering result to the native resolution.
Declaration
public DynamicResUpscaleFilter filter { get; set; }
Property Value
Type | Description |
---|---|
DynamicResUpscaleFilter |
finalViewport
The viewport of the final buffer. This is likely the resolution the dynamic resolution starts from before any scaling. Note this is NOT the target resolution the rendering will happen in but the resolution the scaled rendered result will be upscaled to.
Declaration
public Vector2Int finalViewport { get; set; }
Property Value
Type | Description |
---|---|
Vector2Int |
instance
Get the instance of the global dynamic resolution handler.
Declaration
public static DynamicResolutionHandler instance { get; }
Property Value
Type | Description |
---|---|
DynamicResolutionHandler |
Methods
DynamicResolutionEnabled()
Identifies whether dynamic resolution is enabled and scaling the render targets.
Declaration
public bool DynamicResolutionEnabled()
Returns
Type | Description |
---|---|
Boolean | True: Dynamic resolution is enabled. |
ForceSoftwareFallback()
Forces software fallback for dynamic resolution. Needs to be called in case Hardware dynamic resolution is requested by the user, but not supported by the platform.
Declaration
public void ForceSoftwareFallback()
GetCurrentScale()
Returns the scale that is currently applied by the dynamic resolution system.
Declaration
public float GetCurrentScale()
Returns
Type | Description |
---|---|
Single | The scale that is currently applied by the dynamic resolution system. |
GetLastScaledSize()
Returns the latest scaled size that has been produced by GetScaledSize.
Declaration
public Vector2Int GetLastScaledSize()
Returns
Type | Description |
---|---|
Vector2Int | The latest scaled size that has been produced by GetScaledSize. |
GetScaledSize(Vector2Int)
Applies to the passed size the scale imposed by the dynamic resolution system.
Declaration
public Vector2Int GetScaledSize(Vector2Int size)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | size | The starting size of the render target that will be scaled by dynamic resolution. |
Returns
Type | Description |
---|---|
Vector2Int | The parameter size scaled by the dynamic resolution system. |
HardwareDynamicResIsEnabled()
Determines whether hardware dynamic resolution is enabled or not.
Declaration
public bool HardwareDynamicResIsEnabled()
Returns
Type | Description |
---|---|
Boolean | True: Hardware dynamic resolution is enabled |
RequestsHardwareDynamicResolution()
Identifies whether hardware dynamic resolution has been requested and is going to be used.
Declaration
public bool RequestsHardwareDynamicResolution()
Returns
Type | Description |
---|---|
Boolean | True: Hardware dynamic resolution is requested by user and software fallback has not been forced |
SetCurrentCameraRequest(Boolean)
Set whether the camera that is currently processed by the pipeline has requested dynamic resolution or not.
Declaration
public void SetCurrentCameraRequest(bool cameraRequest)
Parameters
Type | Name | Description |
---|---|---|
Boolean | cameraRequest | Determines whether the camera has requested dynamic resolution or not. |
SetDynamicResScaler(PerformDynamicRes, DynamicResScalePolicyType)
Set the scaler method used to drive dynamic resolution.
Declaration
public static void SetDynamicResScaler(PerformDynamicRes scaler, DynamicResScalePolicyType scalerType = DynamicResScalePolicyType.ReturnsMinMaxLerpFactor)
Parameters
Type | Name | Description |
---|---|---|
PerformDynamicRes | scaler | The delegate used to determine the resolution percentage used by the dynamic resolution system. |
DynamicResScalePolicyType | scalerType | The type of scaler that is used, this is used to indicate the return type of the scaler to the dynamic resolution system. |
SoftwareDynamicResIsEnabled()
Determines whether software dynamic resolution is enabled or not.
Declaration
public bool SoftwareDynamicResIsEnabled()
Returns
Type | Description |
---|---|
Boolean | True: Software dynamic resolution is enabled |
Update(GlobalDynamicResolutionSettings, Action)
Update the state of the dynamic resolution system.
Declaration
public void Update(GlobalDynamicResolutionSettings settings, Action OnResolutionChange = null)
Parameters
Type | Name | Description |
---|---|---|
GlobalDynamicResolutionSettings | settings | The settings that are to be used by the dynamic resolution system. |
Action | OnResolutionChange | An action that will be called every time the dynamic resolution system triggers a change in resolution. |