Class RTHandle
A RTHandle is a RenderTexture that scales automatically with the camera size. This allows proper reutilization of RenderTexture memory when different cameras with various sizes are used during rendering. RTHandleSystem
Namespace: UnityEngine.Rendering
Syntax
public class RTHandle
Properties
isMSAAEnabled
Returns true is MSAA is enabled, false otherwise.
Declaration
public bool isMSAAEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
name
Name of the RTHandle
Declaration
public string name { get; }
Property Value
Type | Description |
---|---|
String |
nameID
RenderTargetIdentifier associated with the RTHandle
Declaration
public RenderTargetIdentifier nameID { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Rendering.RenderTargetIdentifier |
referenceSize
Reference size of the RTHandle System associated with the RTHandle
Declaration
public Vector2Int referenceSize { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector2Int |
rt
RenderTexture associated with the RTHandle
Declaration
public RenderTexture rt { get; }
Property Value
Type | Description |
---|---|
UnityEngine.RenderTexture |
rtHandleProperties
Current properties of the RTHandle System. If a custom property has been set through SetCustomHandleProperties method, it will be used that one instead.
Declaration
public RTHandleProperties rtHandleProperties { get; }
Property Value
Type | Description |
---|---|
RTHandleProperties |
scaleFactor
Scale factor applied to the RTHandle reference size.
Declaration
public Vector2 scaleFactor { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector2 |
useScaling
Returns true if the RTHandle uses automatic scaling.
Declaration
public bool useScaling { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
ClearCustomHandleProperties()
Method that clears any custom handle property being set.
Declaration
public void ClearCustomHandleProperties()
GetInstanceID()
Get the Instance ID of the RTHandle.
Declaration
public int GetInstanceID()
Returns
Type | Description |
---|---|
Int32 | The RTHandle Instance ID. |
GetScaledSize()
Return the scaled size of the RTHandle.
Declaration
public Vector2Int GetScaledSize()
Returns
Type | Description |
---|---|
UnityEngine.Vector2Int | The scaled size of the RTHandle. |
GetScaledSize(Vector2Int)
Return the input size, scaled by the RTHandle scale factor.
Declaration
public Vector2Int GetScaledSize(Vector2Int refSize)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector2Int | refSize | Input size |
Returns
Type | Description |
---|---|
UnityEngine.Vector2Int | Input size scaled by the RTHandle scale factor. |
Release()
Release the RTHandle
Declaration
public void Release()
SetCustomHandleProperties(in RTHandleProperties)
By default, rtHandleProperties gets the global state of scalers against the global reference mode. This method lets the current RTHandle use a local custom RTHandleProperties. This function is being used by scalers such as TAAU and DLSS, which require to have a different resolution for color (independent of the RTHandleSystem).
Declaration
public void SetCustomHandleProperties(in RTHandleProperties properties)
Parameters
Type | Name | Description |
---|---|---|
RTHandleProperties | properties | Properties to set. |
Operators
Implicit(RTHandle to RenderTargetIdentifier)
Implicit conversion operator to RenderTargetIdentifier
Declaration
public static implicit operator RenderTargetIdentifier(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | Input RTHandle |
Returns
Type | Description |
---|---|
UnityEngine.Rendering.RenderTargetIdentifier | RenderTargetIdentifier representation of the RTHandle. |
Implicit(RTHandle to RenderTexture)
Implicit conversion operator to RenderTexture
Declaration
public static implicit operator RenderTexture(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | Input RTHandle |
Returns
Type | Description |
---|---|
UnityEngine.RenderTexture | RenderTexture representation of the RTHandle. |
Implicit(RTHandle to Texture)
Implicit conversion operator to Texture
Declaration
public static implicit operator Texture(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | Input RTHandle |
Returns
Type | Description |
---|---|
UnityEngine.Texture | Texture representation of the RTHandle. |