Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ScalableBufferManager

Scales render textures to support dynamic resolution if the target platform/graphics API supports it.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static class ScalableBufferManager

Remarks

The
ScalableBufferManager
class handles the scaling of any render textures that you have marked as
DynamicallyScalable
when
ResizeBuffers
is called. All render textures marked as
DynamicallyScalable
are scaled by a width and height scale factor. The scale is controlled through a scale factor and not with a specific width and height value because even though render textures are of different sizes, they need to be scaled by a common factor.
The current implementation only supports discrete scale factors in the range of 0.05 and 1.0 in steps of 0.05 to be consistent across all platforms. Unity automatically selects the closest supported scale factors. You can access the selected scale factors using _widthScaleFactor and _heightScaleFactor.
The scaled dimensions are calculated as follows:
width = ceil(renderTexture.width * ScalableBufferManager.widthScaleFactor) height = ceil(renderTexture.height * ScalableBufferManager.heightScaleFactor)
The render textures that you have marked as
DynamicallyScalableExplicit
are not scaled by a call to
ResizeBuffers
but by a call to
RenderTexture.ApplyDynamicScale
. Scaling is subject to the exact same process as
ResizeBuffers
.

Static Properties

Property

Description

heightScaleFactorHeight scale factor to control dynamic resolution.
widthScaleFactorWidth scale factor to control dynamic resolution.

Static Methods

Method

Description

ResizeBuffersFunction to resize all buffers marked as DynamicallyScalable.